https://github.com/aaronpeikert/iv
Independend Validation (IV) with 'rsample'
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 2 committers (50.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.7%) to scientific vocabulary
Keywords from Contributors
structural-equation-modeling
Last synced: 11 months ago
·
JSON representation
Repository
Independend Validation (IV) with 'rsample'
Basic Info
- Host: GitHub
- Owner: aaronpeikert
- License: other
- Language: R
- Default Branch: master
- Size: 27.3 KB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
- Releases: 0
Created almost 7 years ago
· Last pushed almost 3 years ago
Metadata Files
Readme
Contributing
License
Code of conduct
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# Independend Validation (IV)
[](https://opensource.org/licenses/MIT) [](https://github.com/aaronpeikert/iv/issues/new)
Independend Validation is a procedure proposed by von Oertzen (in prep), which produces independend assessment sets. This property is assumed when performing most statistical tests on the performance measures associated with the assesment sets. Importantly classical resampling procedures (like cross validation or bootstrapping) do violate this assumption, because even when the original sample are independend, the resulting assesment and holdout sets are not.
## Installation
You can install the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("aaronpeikert/iv")
```
## Examples
```{r data}
# install.packages("modeldata")
library(modeldata)
data("attrition")
# downsample
attrition <- attrition[sample(seq_len(nrow(attrition)), 100), ]
```
```{r iv}
library(iv)
library(rsample)
iv_obj <- iv(attrition, m = 20)
iv_obj
```
```{r lm_func}
mod_form <- as.formula(Attrition ~ JobSatisfaction + Gender + MonthlyIncome)
## splits will be the `rsplit` object
holdout_results <- function(splits, ...) {
# Fit the model to the 90%
mod <- glm(..., data = analysis(splits), family = binomial)
# Save the 10%
holdout <- assessment(splits)
# `augment` will save the predictions with the holdout data set
res <- broom::augment(mod, newdata = holdout)
# Class predictions on the assessment set from class probs
lvls <- levels(holdout$Attrition)
predictions <- factor(ifelse(res$.fitted > 0, lvls[2], lvls[1]),
levels = lvls)
# Calculate whether the prediction was correct
res$correct <- predictions == holdout$Attrition
# Return the assessment data set with the additional columns
res
}
```
```{r model_purrr, warning=FALSE}
library(purrr)
iv_obj$results <- map(iv_obj$splits,
holdout_results,
mod_form)
iv_obj$accuracy <- map_dbl(iv_obj$results, function(x) mean(x$correct))
summary(iv_obj$accuracy)
```
by [Aaron Peikert](https://orcid.org/0000-0001-7813-818X)
and [Andreas Brandmaier](http://orcid.org/0000-0001-8765-6982).
Owner
- Name: Aaron Peikert
- Login: aaronpeikert
- Kind: user
- Repositories: 15
- Profile: https://github.com/aaronpeikert
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: almost 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Aaron Peikert | a****t@p****e | 17 |
| Aaron Peikert | p****t@m****e | 1 |
Committer Domains (Top 20 + Academic)
mpib-berlin.mpg.de: 1
posteo.de: 1
Issues and Pull Requests
Last synced: over 1 year ago
All Time
- Total issues: 3
- Total pull requests: 0
- Average time to close issues: 10 days
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 0
- Average comments per issue: 0.33
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- aaronpeikert (3)