modelr/0000755000176200001440000000000013624321012011526 5ustar liggesusersmodelr/NAMESPACE0000644000176200001440000000253013623761313012760 0ustar liggesusers# Generated by roxygen2: do not edit by hand S3method(as.data.frame,permutation) S3method(as.data.frame,resample) S3method(as.integer,permutation) S3method(as.integer,resample) S3method(dim,permutation) S3method(dim,resample) S3method(obj_sum,resample) S3method(predictor_vars,default) S3method(print,permutation) S3method(print,resample) S3method(response_var,default) S3method(typical,character) S3method(typical,factor) S3method(typical,integer) S3method(typical,logical) S3method(typical,numeric) S3method(typical,ordered) export("%>%") export(add_predictions) export(add_predictors) export(add_residuals) export(bootstrap) export(crossv_kfold) export(crossv_loo) export(crossv_mc) export(data_grid) export(fit_with) export(formulae) export(formulas) export(gather_predictions) export(gather_residuals) export(geom_ref_line) export(mae) export(mape) export(model_matrix) export(mse) export(na.warn) export(permute) export(permute_) export(qae) export(resample) export(resample_bootstrap) export(resample_partition) export(resample_permutation) export(rmse) export(rsae) export(rsquare) export(seq_range) export(spread_predictions) export(spread_residuals) export(typical) import(rlang) importFrom(broom,tidy) importFrom(magrittr,"%>%") importFrom(purrr,compact) importFrom(purrr,map) importFrom(purrr,reduce) importFrom(stats,quantile) importFrom(tibble,obj_sum) modelr/README.md0000644000176200001440000001436613523017355013031 0ustar liggesusers # modelr [![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://www.tidyverse.org/lifecycle/#stable) [![Travis build status](https://travis-ci.org/tidyverse/modelr.svg?branch=master)](https://travis-ci.org/tidyverse/modelr) [![Codecov test coverage](https://codecov.io/gh/tidyverse/modelr/branch/master/graph/badge.svg)](https://codecov.io/gh/tidyverse/modelr?branch=master) ## Overview The modelr package provides functions that help you create elegant pipelines when modelling. It is designed primarily to support teaching the basics of modelling within the tidyverse, particularly in [R for Data Science](http://r4ds.had.co.nz/model-basics.html). ## Installation ``` r # The easiest way to get modelr is to install the whole tidyverse: install.packages("tidyverse") # Alternatively, install just modelr: install.packages("modelr") # Or the development version from GitHub: # install.packages("devtools") devtools::install_github("tidyverse/modelr") ``` ## Status modelr is stable: it has achieved its goal of making it easier to teach modelling within the tidyverse. For more general modelling tasks, check out the family of “tidymodel” packages like [recipes](https://topepo.github.io/recipes/), [rsample](https://topepo.github.io/rsample/), [parsnip](https://topepo.github.io/parsnip/), and [tidyposterior](https://topepo.github.io/tidyposterior/). ## Getting started ``` r library(modelr) ``` ### Partitioning and sampling The `resample` class stores a “reference” to the original dataset and a vector of row indices. A resample can be turned into a dataframe by calling `as.data.frame()`. The indices can be extracted using `as.integer()`: ``` r # a subsample of the first ten rows in the data frame rs <- resample(mtcars, 1:10) as.data.frame(rs) #> mpg cyl disp hp drat wt qsec vs am gear carb #> Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 #> Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 #> Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 #> Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 #> Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 #> Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 #> Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 #> Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 #> Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 #> Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 as.integer(rs) #> [1] 1 2 3 4 5 6 7 8 9 10 ``` The class can be utilized in generating an exclusive partitioning of a data frame: ``` r # generate a 30% testing partition and a 70% training partition ex <- resample_partition(mtcars, c(test = 0.3, train = 0.7)) lapply(ex, dim) #> $test #> [1] 9 11 #> #> $train #> [1] 23 11 ``` modelr offers several resampling methods that result in a list of `resample` objects (organized in a data frame): ``` r # bootstrap boot <- bootstrap(mtcars, 100) # k-fold cross-validation cv1 <- crossv_kfold(mtcars, 5) # Monte Carlo cross-validation cv2 <- crossv_mc(mtcars, 100) dim(boot$strap[[1]]) #> [1] 32 11 dim(cv1$train[[1]]) #> [1] 25 11 dim(cv1$test[[1]]) #> [1] 7 11 dim(cv2$train[[1]]) #> [1] 25 11 dim(cv2$test[[1]]) #> [1] 7 11 ``` ### Model quality metrics modelr includes several often-used model quality metrics: ``` r mod <- lm(mpg ~ wt, data = mtcars) rmse(mod, mtcars) #> [1] 2.949163 rsquare(mod, mtcars) #> [1] 0.7528328 mae(mod, mtcars) #> [1] 2.340642 qae(mod, mtcars) #> 5% 25% 50% 75% 95% #> 0.1784985 1.0005640 2.0946199 3.2696108 6.1794815 ``` ### Interacting with models A set of functions let you seamlessly add predictions and residuals as additional columns to an existing data frame: ``` r set.seed(1014) df <- tibble::data_frame( x = sort(runif(100)), y = 5 * x + 0.5 * x ^ 2 + 3 + rnorm(length(x)) ) #> Warning: `data_frame()` is deprecated, use `tibble()`. #> This warning is displayed once per session. mod <- lm(y ~ x, data = df) df %>% add_predictions(mod) #> # A tibble: 100 x 3 #> x y pred #> #> 1 0.00740 3.90 3.08 #> 2 0.0201 2.86 3.15 #> 3 0.0280 2.93 3.19 #> 4 0.0281 3.16 3.19 #> 5 0.0312 3.19 3.21 #> 6 0.0342 3.72 3.23 #> 7 0.0514 0.984 3.32 #> 8 0.0586 5.98 3.36 #> 9 0.0637 2.96 3.39 #> 10 0.0652 3.54 3.40 #> # … with 90 more rows df %>% add_residuals(mod) #> # A tibble: 100 x 3 #> x y resid #> #> 1 0.00740 3.90 0.822 #> 2 0.0201 2.86 -0.290 #> 3 0.0280 2.93 -0.256 #> 4 0.0281 3.16 -0.0312 #> 5 0.0312 3.19 -0.0223 #> 6 0.0342 3.72 0.496 #> 7 0.0514 0.984 -2.34 #> 8 0.0586 5.98 2.62 #> 9 0.0637 2.96 -0.428 #> 10 0.0652 3.54 0.146 #> # … with 90 more rows ``` For visualization purposes it is often useful to use an evenly spaced grid of points from the data: ``` r data_grid(mtcars, wt = seq_range(wt, 10), cyl, vs) #> # A tibble: 60 x 3 #> wt cyl vs #> #> 1 1.51 4 0 #> 2 1.51 4 1 #> 3 1.51 6 0 #> 4 1.51 6 1 #> 5 1.51 8 0 #> 6 1.51 8 1 #> 7 1.95 4 0 #> 8 1.95 4 1 #> 9 1.95 6 0 #> 10 1.95 6 1 #> # … with 50 more rows # For continuous variables, seq_range is useful mtcars_mod <- lm(mpg ~ wt + cyl + vs, data = mtcars) data_grid(mtcars, wt = seq_range(wt, 10), cyl, vs) %>% add_predictions(mtcars_mod) #> # A tibble: 60 x 4 #> wt cyl vs pred #> #> 1 1.51 4 0 28.4 #> 2 1.51 4 1 28.9 #> 3 1.51 6 0 25.6 #> 4 1.51 6 1 26.2 #> 5 1.51 8 0 22.9 #> 6 1.51 8 1 23.4 #> 7 1.95 4 0 27.0 #> 8 1.95 4 1 27.5 #> 9 1.95 6 0 24.2 #> 10 1.95 6 1 24.8 #> # … with 50 more rows ``` ## Code of conduct Please note that this project is released with a [Contributor Code of Conduct](https://modelr.tidyverse.org/CODE_OF_CONDUCT.html). By participating in this project you agree to abide by its terms. modelr/data/0000755000176200001440000000000012743765777012476 5ustar liggesusersmodelr/data/sim1.rda0000644000176200001440000000077112743765777014044 0ustar liggesusersBZh91AY&SYD  g]:V^fU=>O0ᵰ8@T)hځOPAh4i=&ѣG&cH1DdiF&F&4 #F L0 5%6@@.YJf QtGTX]em|pAP_Uج }f6D @EA>BYFLT8ȇ !IbUIOZ]j{ tJpy8- 2= #vpO6+}NjUD-a1 \pI,٪OE .`mpBR WprZt#T| 05ۄܸB ɘ6{4#Zo7Sg;Sˣ[!VTb^mQF4X*1 H:A԰8F=dH+')„&hmodelr/data/heights.rda0000644000176200001440000014716012734266502014610 0ustar liggesusersBZh91AY&SY_a( U |R}@@@P(PP K _>P(EPQT*  $QI M $*TTT$QJ>D>INzlPǣlSϷiӡ @|PSl[(m2PF5]u=@֭ݍ}O jS*Uo xrJ Pv:KyWک]{ܹ}4e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rd0000644000176200001440000000136213134626747015603 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/formulas.R \name{add_predictors} \alias{add_predictors} \title{Add predictors to a formula} \usage{ add_predictors(f, ..., fun = "+") } \arguments{ \item{f}{A formula.} \item{...}{Formulas whose right-hand sides will be merged to \code{f}.} \item{fun}{A function name indicating how to merge the right-hand sides.} } \description{ This merges a one- or two-sided formula \code{f} with the right-hand sides of all formulas supplied in \code{...}. } \examples{ f <- lhs ~ rhs add_predictors(f, ~var1, ~var2) # Left-hand sides are ignored: add_predictors(f, lhs1 ~ var1, lhs2 ~ var2) # fun can also be set to a function like "*": add_predictors(f, ~var1, ~var2, fun = "*") } modelr/man/resample_permutation.Rd0000644000176200001440000000106113134631647017043 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/permute.R \name{resample_permutation} \alias{resample_permutation} \title{Create a resampled permutation of a data frame} \usage{ resample_permutation(data, columns, idx = NULL) } \arguments{ \item{data}{A data frame} \item{columns}{Columns to be permuted} \item{idx}{Indices to permute by. If not given, generates them randomly} } \value{ A permutation object; use as.data.frame to convert to a permuted data frame } \description{ Create a resampled permutation of a data frame } modelr/man/bootstrap.Rd0000644000176200001440000000165213623760427014631 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bootstrap.R \name{bootstrap} \alias{bootstrap} \title{Generate \code{n} bootstrap replicates.} \usage{ bootstrap(data, n, id = ".id") } \arguments{ \item{data}{A data frame} \item{n}{Number of bootstrap replicates to generate} \item{id}{Name of variable that gives each model a unique integer id.} } \value{ A data frame with \code{n} rows and one column: \code{strap} } \description{ Generate \code{n} bootstrap replicates. } \examples{ library(purrr) boot <- bootstrap(mtcars, 100) models <- map(boot$strap, ~ lm(mpg ~ wt, data = .)) tidied <- map_df(models, broom::tidy, .id = "id") hist(subset(tidied, term == "wt")$estimate) hist(subset(tidied, term == "(Intercept)")$estimate) } \seealso{ Other resampling techniques: \code{\link{resample_bootstrap}()}, \code{\link{resample_partition}()}, \code{\link{resample}()} } \concept{resampling techniques} modelr/man/permute.Rd0000644000176200001440000000264613275046710014274 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/permute.R \name{permute} \alias{permute} \alias{permute_} \title{Generate \code{n} permutation replicates.} \usage{ permute(data, n, ..., .id = ".id") permute_(data, n, columns, .id = ".id") } \arguments{ \item{data}{A data frame} \item{n}{Number of permutations to generate.} \item{...}{Columns to permute. This supports bare column names or dplyr \link[dplyr:select_helpers]{dplyr::select_helpers}} \item{.id}{Name of variable that gives each model a unique integer id.} \item{columns}{In \code{permute_}, vector of column names to permute.} } \value{ A data frame with \code{n} rows and one column: \code{perm} } \description{ A permutation test involves permuting one or more variables in a data set before performing the test, in order to break any existing relationships and simulate the null hypothesis. One can then compare the true statistic to the generated distribution of null statistics. } \examples{ library(purrr) perms <- permute(mtcars, 1000, mpg) models <- map(perms$perm, ~ lm(mpg ~ wt, data = .)) glanced <- map_df(models, broom::glance, .id = "id") # distribution of null permutation statistics hist(glanced$statistic) # confirm these are roughly uniform p-values hist(glanced$p.value) # test against the unpermuted model to get a permutation p-value mod <- lm(mpg ~ wt, mtcars) mean(glanced$statistic > broom::glance(mod)$statistic) } modelr/man/resample_bootstrap.Rd0000644000176200001440000000117713623760427016523 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/bootstrap.R \name{resample_bootstrap} \alias{resample_bootstrap} \title{Generate a boostrap replicate} \usage{ resample_bootstrap(data) } \arguments{ \item{data}{A data frame} } \description{ Generate a boostrap replicate } \examples{ coef(lm(mpg ~ wt, data = resample_bootstrap(mtcars))) coef(lm(mpg ~ wt, data = resample_bootstrap(mtcars))) coef(lm(mpg ~ wt, data = resample_bootstrap(mtcars))) } \seealso{ Other resampling techniques: \code{\link{bootstrap}()}, \code{\link{resample_partition}()}, \code{\link{resample}()} } \concept{resampling techniques} modelr/man/add_residuals.Rd0000644000176200001440000000260413275046542015413 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/residuals.R \name{add_residuals} \alias{add_residuals} \alias{spread_residuals} \alias{gather_residuals} \title{Add residuals to a data frame} \usage{ add_residuals(data, model, var = "resid") spread_residuals(data, ...) gather_residuals(data, ..., .resid = "resid", .model = "model") } \arguments{ \item{data}{A data frame used to generate the residuals} \item{model, var}{\code{add_residuals} takes a single \code{model}; the output column will be called \code{resid}} \item{...}{\code{gather_residuals} and \code{spread_residuals} take multiple models. The name will be taken from either the argument name of the name of the model.} \item{.resid, .model}{The variable names used by \code{gather_residuals}.} } \value{ A data frame. \code{add_residuals} adds a single new column, \code{.resid}, to the input \code{data}. \code{spread_residuals} adds one column for each model. \code{gather_predictions} adds two columns \code{.model} and \code{.resid}, and repeats the input rows for each model. } \description{ Add residuals to a data frame } \examples{ df <- tibble::data_frame( x = sort(runif(100)), y = 5 * x + 0.5 * x ^ 2 + 3 + rnorm(length(x)) ) plot(df) m1 <- lm(y ~ x, data = df) df \%>\% add_residuals(m1) m2 <- lm(y ~ poly(x, 2), data = df) df \%>\% spread_residuals(m1, m2) df \%>\% gather_residuals(m1, m2) } modelr/man/crossv_mc.Rd0000644000176200001440000000303213426133222014570 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/cross-validation.R \name{crossv_mc} \alias{crossv_mc} \alias{crossv_kfold} \alias{crossv_loo} \title{Generate test-training pairs for cross-validation} \usage{ crossv_mc(data, n, test = 0.2, id = ".id") crossv_kfold(data, k = 5, id = ".id") crossv_loo(data, id = ".id") } \arguments{ \item{data}{A data frame} \item{n}{Number of test-training pairs to generate (an integer).} \item{test}{Proportion of observations that should be held out for testing (a double).} \item{id}{Name of variable that gives each model a unique integer id.} \item{k}{Number of folds (an integer).} } \value{ A data frame with columns \code{test}, \code{train}, and \code{.id}. \code{test} and \code{train} are list-columns containing \code{\link[=resample]{resample()}} objects. The number of rows is \code{n} for \code{crossv_mc()}, \code{k} for \code{crossv_kfold()} and \code{nrow(data)} for \code{crossv_loo()}. } \description{ \code{crossv_kfold} splits the data into \code{k} exclusive partitions, and uses each partition for a test-training split. \code{crossv_mc} generates \code{n} random partitions, holding out \code{test} of the data for training. \code{crossv_loo} performs leave-one-out cross-validation, i.e., \code{n = nrow(data)} training partitions containing \code{n - 1} rows each. } \examples{ cv1 <- crossv_kfold(mtcars, 5) cv1 library(purrr) cv2 <- crossv_mc(mtcars, 100) models <- map(cv2$train, ~ lm(mpg ~ wt, data = .)) errs <- map2_dbl(models, cv2$test, rmse) hist(errs) } modelr/man/na.warn.Rd0000644000176200001440000000150713623760455014160 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/na-warn.R \name{na.warn} \alias{na.warn} \title{Handle missing values with a warning} \usage{ na.warn(object) } \arguments{ \item{object}{A data frame} } \description{ This NA handler ensures that those models that support the \code{na.action} parameter do not silently drop missing values. It wraps around \code{\link[stats:na.exclude]{stats::na.exclude()}} so that there is one prediction/residual for input row. To apply it globally, run \code{options(na.action = na.warn)}. } \examples{ df <- tibble::tibble( x = 1:10, y = c(5.1, 9.7, NA, 17.4, 21.2, 26.6, 27.9, NA, 36.3, 40.4) ) # Default behaviour is to silently drop m1 <- lm(y ~ x, data = df) resid(m1) # Use na.action = na.warn to warn m2 <- lm(y ~ x, data = df, na.action = na.warn) resid(m2) } modelr/man/heights.Rd0000644000176200001440000000166213275046542014246 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/data.R \docType{data} \name{heights} \alias{heights} \title{Height and income data.} \format{\describe{ \item{income}{Yearly income. The top two percent of values were averaged and that average was used to replace all values in the top range. } \item{height}{Height, in feet} \item{weight}{Weight, in pounds} \item{age}{Age, in years, between 47 and 56.} \item{marital}{Marital status} \item{sex}{Sex} \item{education}{Years of education} \item{afqt}{Percentile score on Armed Forces Qualification Test.} }} \usage{ heights } \description{ You might have heard that taller people earn more. Is it true? You can try and answer the question by exploring this dataset extracted from the \href{https://www.nlsinfo.org}{National Longitudinal Study}, which is sponsored by the U.S. Bureau of Labor Statistics. } \details{ This contains data as at 2012. } \keyword{datasets} modelr/man/formulas.Rd0000644000176200001440000000164613134626747014452 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/formulas.R \name{formulas} \alias{formulas} \alias{formulae} \title{Create a list of formulas} \usage{ formulas(.response, ...) formulae(.response, ...) } \arguments{ \item{.response}{A one-sided formula used as the left-hand side of all resulting formulas.} \item{...}{List of formulas whose right-hand sides will be merged to \code{.response}.} } \description{ \code{formulas()} creates a list of two-sided formulas by merging a unique left-hand side to a list of right-hand sides. } \examples{ # Provide named arguments to create a named list of formulas: models <- formulas(~lhs, additive = ~var1 + var2, interaction = ~var1 * var2 ) models$additive # The formulas are created sequentially, so that you can refer to # previously created formulas: formulas(~lhs, linear = ~var1 + var2, hierarchical = add_predictors(linear, ~(1 | group)) ) } modelr/man/figures/0000755000176200001440000000000013275106354013761 5ustar liggesusersmodelr/man/figures/logo.png0000644000176200001440000007603413275106354015441 0ustar liggesusersPNG  IHDRxb]esRGB pHYs  iTXtXML:com.adobe.xmp Adobe ImageReady 1 ).=@IDATxܝ\U7 B Q"E@TPlJ -@*H/lgϝY';3{9k]sL 1c=D~_}Yg%Ho71:ڵk4:-'%%+[ R7ר~7:baSNI*}- fXȁh4jwr^xa.cPk,VK` ~`ND" Eb +}νIv]M$A\?@)Q0}%d/-N'gO<둳~(3j1@cpPh̝QG/ ēWrHA6n諫suGyzO(Z||OcGII>Y[kutZrr$ض@X}P%Փ~iyyy~iiUVu!k׮8%? /,Y⨓I?@ P.(wȁ *>G}Vk{m eڒA>q@ظ/Qkl{>/9"'m%4-0{;8)N߁Jrrk,PzzmplEřv#I3/bR^עm/Q+o`MfB]paly(, |$Yph(bmm=PcC3*㬨 `EU 1Ү( 3, E MQdzPy7^|ō[E^Ĝ.d2 9 0}VWi=]ÎSCvч֭;u- R-n®V\n9iZmQ*`>駟໣Sw~ya|rN&J.Kr'%loִ[MUtfV567S_ 6>h/x̊ʬz:{̲a9 gwv8#dIPc1 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ͮ&Q4/JsOZH)sJpW|y%@,X77͞9YJ}-ˉ3. A8=<5<2/?X &) -\ ,''Z, hWzOyцpv P y^jU6^:a#~d1//Zϟ 1N13yq5/ղ͛7g^ϟO qG D:.,SeK̗ȴs|q+B_# XxX %_y$'}?hIENDB`modelr/man/sim.Rd0000644000176200001440000000072313134626747013405 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/data.R \docType{data} \name{sim} \alias{sim} \alias{sim1} \alias{sim2} \alias{sim3} \alias{sim4} \title{Simple simulated datasets} \format{An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 30 rows and 2 columns.} \usage{ sim1 sim2 sim3 sim4 } \description{ These simple simulated datasets are useful for teaching modelling basics. } \keyword{datasets} modelr/man/pipe.Rd0000644000176200001440000000032013134626747013543 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/utils.R \name{\%>\%} \alias{\%>\%} \title{Pipe operator} \usage{ lhs \%>\% rhs } \description{ Pipe operator } \keyword{internal} modelr/man/fit_with.Rd0000644000176200001440000000266013523022714014416 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/formulas.R \name{fit_with} \alias{fit_with} \title{Fit a list of formulas} \usage{ fit_with(data, .f, .formulas, ...) } \arguments{ \item{data}{A dataset used to fit the models.} \item{.f}{A fitting function such as \code{\link[stats:lm]{stats::lm()}}, \code{\link[lme4:lmer]{lme4::lmer()}} or \code{\link[rstanarm:stan_glmer]{rstanarm::stan_glmer()}}.} \item{.formulas}{A list of formulas specifying a model.} \item{...}{Additional arguments passed on to \code{.f}} } \description{ \code{fit_with()} is a pipe-friendly tool that applies a list of formulas to a fitting function such as \code{\link[stats:lm]{stats::lm()}}. The list of formulas is typically created with \code{\link[=formulas]{formulas()}}. } \details{ Assumes that \code{.f} takes the formula either as first argument or as second argument if the first argument is \code{data}. Most fitting functions should fit these requirements. } \examples{ # fit_with() is typically used with formulas(). disp_fits <- mtcars \%>\% fit_with(lm, formulas(~disp, additive = ~drat + cyl, interaction = ~drat * cyl, full = add_predictors(interaction, ~am, ~vs) )) # The list of fitted models is named after the names of the list of # formulas: disp_fits$full # Additional arguments are passed on to .f mtcars \%>\% fit_with(glm, list(am ~ disp), family = binomial) } \seealso{ \code{\link[=formulas]{formulas()}} } modelr/man/data_grid.Rd0000644000176200001440000000222713473322117014522 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/data-grid.R \name{data_grid} \alias{data_grid} \title{Generate a data grid.} \usage{ data_grid(data, ..., .model = NULL) } \arguments{ \item{data}{A data frame} \item{...}{Variables passed on to \code{\link[tidyr:expand]{tidyr::expand()}}} \item{.model}{A model. If supplied, any predictors needed for the model not present in \code{...} will be filled in with "\link{typical}" values.} } \description{ To visualise a model, it is very useful to be able to generate an evenly spaced grid of points from the data. \code{data_grid} helps you do this by wrapping around \code{\link[tidyr:expand]{tidyr::expand()}}. } \examples{ data_grid(mtcars, vs, am) # For continuous variables, seq_range is useful data_grid(mtcars, mpg = mpg) data_grid(mtcars, mpg = seq_range(mpg, 10)) # If you supply a model, missing predictors will be filled in with # typical values mod <- lm(mpg ~ wt + cyl + vs, data = mtcars) data_grid(mtcars, .model = mod) data_grid(mtcars, cyl = seq_range(cyl, 9), .model = mod) } \seealso{ \code{\link[=seq_range]{seq_range()}} for generating ranges from continuous variables. } modelr/man/seq_range.Rd0000644000176200001440000000262413623760332014553 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/seq_range.R \name{seq_range} \alias{seq_range} \title{Generate a sequence over the range of a vector} \usage{ seq_range(x, n, by, trim = NULL, expand = NULL, pretty = FALSE) } \arguments{ \item{x}{A numeric vector} \item{n, by}{Specify the output sequence either by supplying the length of the sequence with \code{n}, or the spacing between value with \code{by}. Specifying both is an error. I recommend that you name these arguments in order to make it clear to the reader.} \item{trim}{Optionally, trim values off the tails. \code{trim / 2 * length(x)} values are removed from each tail.} \item{expand}{Optionally, expand the range by \verb{expand * (1 + range(x)} (computed after trimming).} \item{pretty}{If \code{TRUE}, will generate a pretty sequence. If \code{n} is supplied, this will use \code{\link[=pretty]{pretty()}} instead of \code{\link[=seq]{seq()}}. If \code{by} is supplied, it will round the first value to a multiple of \code{by}.} } \description{ Generate a sequence over the range of a vector } \examples{ x <- rcauchy(100) seq_range(x, n = 10) seq_range(x, n = 10, trim = 0.1) seq_range(x, by = 1, trim = 0.1) # Make pretty sequences y <- runif(100) seq_range(y, n = 10) seq_range(y, n = 10, pretty = TRUE) seq_range(y, n = 10, expand = 0.5, pretty = TRUE) seq_range(y, by = 0.1) seq_range(y, by = 0.1, pretty = TRUE) } modelr/man/resample.Rd0000644000176200001440000000227413623760427014425 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/resample.R \name{resample} \alias{resample} \title{A "lazy" resample.} \usage{ resample(data, idx) } \arguments{ \item{data}{The data frame} \item{idx}{A vector of integer indexes indicating which rows have been selected. These values should lie between 1 and \code{nrow(data)} but they are not checked by this function in the interests of performance.} } \description{ Often you will resample a dataset hundreds or thousands of times. Storing the complete resample each time would be very inefficient so this class instead stores a "pointer" to the original dataset, and a vector of row indexes. To turn this into a regular data frame, call \code{as.data.frame}, to extract the indices, use \code{as.integer}. } \examples{ resample(mtcars, 1:10) b <- resample_bootstrap(mtcars) b as.integer(b) as.data.frame(b) # Many modelling functions will do the coercion for you, so you can # use a resample object directly in the data argument lm(mpg ~ wt, data = b) } \seealso{ Other resampling techniques: \code{\link{bootstrap}()}, \code{\link{resample_bootstrap}()}, \code{\link{resample_partition}()} } \concept{resampling techniques} modelr/man/typical.Rd0000644000176200001440000000162313275046524014255 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/typical.R \name{typical} \alias{typical} \title{Find the typical value} \usage{ typical(x, ...) } \arguments{ \item{x}{A vector} \item{...}{Arguments used by methods} } \description{ For numeric, integer, and ordered factor vectors, it returns the median. For factors, characters, and logical vectors, it returns the most frequent value. If multiple values are tied for most frequent, it returns them all. \code{NA} missing values are always silently dropped. } \examples{ # median of numeric vector typical(rpois(100, lambda = 10)) # most frequent value of character or factor x <- sample(c("a", "b", "c"), 100, prob = c(0.6, 0.2, 0.2), replace = TRUE) typical(x) typical(factor(x)) # if tied, returns them all x <- c("a", "a", "b", "b", "c") typical(x) # median of an ordered factor typical(ordered(c("a", "a", "b", "c", "d"))) } modelr/man/modelr-package.Rd0000644000176200001440000000146113623760332015460 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/modelr.R \docType{package} \name{modelr-package} \alias{modelr} \alias{modelr-package} \title{modelr: Modelling Functions that Work with the Pipe} \description{ \if{html}{\figure{logo.png}{options: align='right' alt='logo' width='120'}} Functions for modelling that help you seamlessly integrate modelling into a pipeline of data manipulation and visualisation. } \seealso{ Useful links: \itemize{ \item \url{https://modelr.tidyverse.org} \item \url{https://github.com/tidyverse/modelr} \item Report bugs at \url{https://github.com/tidyverse/modelr/issues} } } \author{ \strong{Maintainer}: Hadley Wickham \email{hadley@rstudio.com} Other contributors: \itemize{ \item RStudio [copyright holder] } } \keyword{internal} modelr/DESCRIPTION0000644000176200001440000000201313624321012013230 0ustar liggesusersPackage: modelr Title: Modelling Functions that Work with the Pipe Version: 0.1.6 Authors@R: c(person(given = "Hadley", family = "Wickham", role = c("aut", "cre"), email = "hadley@rstudio.com"), person(given = "RStudio", role = "cph")) Description: Functions for modelling that help you seamlessly integrate modelling into a pipeline of data manipulation and visualisation. License: GPL-3 URL: https://modelr.tidyverse.org, https://github.com/tidyverse/modelr BugReports: https://github.com/tidyverse/modelr/issues Depends: R (>= 3.2) Imports: broom, dplyr, magrittr, purrr (>= 0.2.2), rlang (>= 0.2.0), tibble, tidyr (>= 0.8.0), tidyselect Suggests: compiler, covr, ggplot2, testthat Encoding: UTF-8 LazyData: true RoxygenNote: 7.0.2 NeedsCompilation: no Packaged: 2020-02-22 20:38:43 UTC; hadley Author: Hadley Wickham [aut, cre], RStudio [cph] Maintainer: Hadley Wickham Repository: CRAN Date/Publication: 2020-02-22 21:50:02 UTC modelr/tests/0000755000176200001440000000000012727615525012712 5ustar liggesusersmodelr/tests/testthat/0000755000176200001440000000000013624321012014530 5ustar liggesusersmodelr/tests/testthat/test-predictions.R0000644000176200001440000000147113623760751020176 0ustar liggesuserscontext("predictions") test_that("always uses na.action = na.exclude", { df <- tibble::tibble(x = c(1, 2, NA), y = c(1.5, 2, 3.5)) mod <- lm(y ~ x, data = df) out <- add_predictions(df, mod) expect_equal(2 * 2, 4) }) test_that("*_predictions() return expected shapes", { df <- tibble::tibble(x = 1:5, y = c(1, 4, 3, 2, 5)) mod <- lm(y ~ x, data = df) out <- add_predictions(df, mod) expect_s3_class(out, "tbl_df") expect_named(out, c("x", "y", "pred")) out <- spread_predictions(df, m1 = mod, m2 = mod) expect_s3_class(out, "tbl_df") expect_named(out, c("x", "y", "m1", "m2")) expect_equal(nrow(out), nrow(df)) out <- gather_predictions(df, m1 = mod, m2 = mod) expect_s3_class(out, "tbl_df") expect_named(out, c("model", "x", "y", "pred")) expect_equal(nrow(out), nrow(df) * 2) }) modelr/tests/testthat/test-data-grid.R0000644000176200001440000000077313432533345017506 0ustar liggesuserscontext("test-data-grid.R") test_that("can generate typical values", { df <- tibble::tibble( x = rep(c("a", "b"), each = 5), y = rep(c("a", "b"), 5), z = rnorm(10) ) mod <- lm(z ~ x + y, data = df) out <- data_grid(df, .model = mod) expect_equal(out$x, c("a", "a", "b", "b")) expect_equal(out$y, c("a", "b", "a", "b")) }) test_that("data_grid() returns a tibble", { mod <- lm(mpg ~ wt, data = mtcars) out <- data_grid(mtcars, .model = mod) expect_s3_class(out, "tbl_df") }) modelr/tests/testthat/test-model-matrix.R0000644000176200001440000000024013432533345020241 0ustar liggesuserscontext("model-matrix") test_that("model_matrix() returns a tibble", { out <- model_matrix(iris, Sepal.Length ~ Species) expect_s3_class(out, "tbl_df") }) modelr/tests/testthat/test-residuals.R0000644000176200001440000000115513432533345017640 0ustar liggesuserscontext("residuals") test_that("*_residuals() return expected shapes", { df <- tibble::tibble(x = 1:5, y = c(1, 4, 3, 2, 5)) m1 <- lm(y ~ x, data = df) m2 <- lm(y ~ poly(x, 2), data = df) out <- spread_residuals(df, m1, m2) expect_s3_class(out, "tbl_df") expect_named(out, c("x", "y", "m1", "m2")) expect_equal(nrow(out), nrow(df)) out <- gather_residuals(df, m1, m2) expect_s3_class(out, "tbl_df") expect_named(out, c("model", "x", "y", "resid")) expect_equal(nrow(out), nrow(df) * 2) out <- add_residuals(df, m1) expect_s3_class(out, "tbl_df") expect_named(out, c("x", "y", "resid")) }) modelr/tests/testthat/test-cross-validate.R0000644000176200001440000000137613432533345020572 0ustar liggesuserscontext("test-cross-validate") test_that("number of crossfolds is a single integer", { expect_error(crossv_kfold(mtcars, k = "0"), "single integer") expect_error(crossv_kfold(mtcars, k = c(1, 2)), "single integer") }) test_that("% of observations held out for testing is between 0 and 1", { expect_error(crossv_mc(mtcars, n = 100, test = 2), "value between") }) test_that("number of training pairs to generate is a single integer", { expect_error(crossv_mc(mtcars, n = c(1,2)), "single integer") expect_error(crossv_mc(mtcars, n = "0"), "single integer") }) test_that("crossv_kfold() and crossv_mc() return tibbles", { out <- crossv_kfold(mtcars, 5) expect_s3_class(out, "tbl_df") out <- crossv_mc(mtcars, 5) expect_s3_class(out, "tbl_df") }) modelr/tests/testthat/test-na-warn.R0000644000176200001440000000042413432533345017206 0ustar liggesuserscontext("test-na-warn") test_that("na.warn warns when dropping", { df <- data.frame(x = 1:5, y = c(1, NA, 3, NA, 5)) expect_warning(mod <- lm(y ~ x, data = df, na.action = na.warn), "Dropping 2") pred <- unname(predict(mod)) expect_equal(is.na(pred), is.na(df$y)) }) modelr/tests/testthat/test-response_var.R0000644000176200001440000000047412730547514020361 0ustar liggesuserscontext("response_var") test_that("can extract response from linear model", { mod <- lm(mpg ~ wt, data = mtcars) expect_identical(response_var(mod), quote(mpg)) }) test_that("can extract response from loess model", { mod <- loess(mpg ~ wt, data = mtcars) expect_identical(response_var(mod), quote(mpg)) }) modelr/tests/testthat/test-geom-ref-line.R0000644000176200001440000000021213432533345020264 0ustar liggesuserscontext("geom-ref-line") test_that("at least one ref line position argument is supplied", { expect_error(geom_ref_line(), "one of") }) modelr/tests/testthat/test-seq-range.R0000644000176200001440000000067613432533345017536 0ustar liggesuserscontext("seq-range") test_that("seq_range() can generate error messages and typical values", { x <- 1:4 expect_error( seq_range(x, by = 0.1, n = 10, expand = 0.5, pretty = TRUE), "one of" ) expect_equal(seq_range(x, n = 4), c(1, 2, 3, 4)) out <- seq_range(x, n = 3, expand = 0.5, pretty = TRUE) expect_equal(out, c(0, 2, 4, 6)) out <- seq_range(x, by = 150, expand = 0.5, pretty = TRUE) expect_equal(out, c(0, 150)) }) modelr/tests/testthat/test-resample-partition.R0000644000176200001440000000116213432533345021462 0ustar liggesuserscontext("resample-partition") test_that("resample_partition() generates error messages & warnings", { expect_error( resample_partition(mtcars, c(test = "0.8", train = 0.7)), "numeric vector" ) expect_error( resample_partition(mtcars, c(train = 0.7)), "numeric vector" ) expect_error( resample_partition(mtcars, c(0.3, 0.7)), "numeric vector" ) expect_message( resample_partition(mtcars, c(test = 0.8, train = 0.7)), "sum to" ) }) test_that("resample_partition() returns a list", { out <- resample_partition(mtcars, c(test = 0.3, train = 0.7)) expect_true(is.list(out)) }) modelr/tests/testthat/test-typical.R0000644000176200001440000000261213424144743017312 0ustar liggesuserscontext("typical") test_that("typical.numeric works as expected", { x <- c(1, 2, 5) expect_equal(typical(x), median(x)) expect_equal(typical(c(x, NA)), median(x)) }) test_that("typical.character works as exepected", { expect_equal(typical(c("a", "a", "b")), "a") expect_equal(typical(c("a", "a", "b", "b", NA_character_)), c("a", "b")) expect_equal(typical(c("a", "a", "b", "b")), c("a", "b")) }) test_that("NA values are considered typical", { x <- c(NA, NA, NA, "x") expect_equal(typical(x), NA_character_) f <- factor(x, exclude = NULL) expect_equal(typical(f), NA_character_) }) test_that("typical.factor works as exepected", { expect_equal(typical(factor(c("a", "a", "b"))), "a") expect_equal(typical(factor(c("a", "a", "b", NA))), "a") expect_equal(typical(factor(c("a", "a", "b", "b"))), c("a", "b")) }) test_that("typical.logical works as exepected", { expect_equal(typical(c(TRUE, FALSE, TRUE)), TRUE) expect_equal(typical(c(TRUE, TRUE, FALSE, FALSE)), TRUE) expect_equal(typical(c(TRUE, FALSE, TRUE, NA)), TRUE) }) test_that("typical.ordered works as expected", { expect_identical(typical(ordered(c("d", "d", "a", "b"))), "b") expect_identical(typical(ordered(c("d", "d", "a", "b", NA))), "b") }) test_that("typical.integer works as expected", { expect_identical(typical(c(1L, 2L, 3L, 8L)), 2L) expect_identical(typical(c(1L, 2L, 3L, 8L, NA_integer_)), 2L) }) modelr/tests/testthat/test-formulas.R0000644000176200001440000000336413275066444017507 0ustar liggesusers context("formulas") test_that("add_predictors() combines predictors", { expect_identical(add_predictors(~1, ~2, ~3), ~1 + 2 + 3) }) test_that("add_predictors() combines with fun", { expect_identical(add_predictors(~1, ~2, ~3, fun = "*"), ~1 * 2 * 3) }) test_that("add_predictors() handles lhss", { expect_identical(add_predictors(lhs ~ 1, ~2), lhs ~ 1 + 2) expect_identical(add_predictors(lhs1 ~ 1, lhs2 ~ 2), lhs1 ~ 1 + 2) }) test_that("merge_formula() handles lhss", { expect_identical(merge_formulas(lhs ~ rhs, lhs ~ rhs), lhs ~ rhs + rhs) expect_error(merge_formulas(lhs ~ rhs, other_lhs ~ rhs), "must be identical") }) test_that("merging formulas fail when scope conflicts within symbols", { env <- new.env(parent = emptyenv()) env$object <- list() object <- list() f_conflict <- new_formula(NULL, quote(object), env = env) expect_error(merge_envs(~object, f_conflict), "conflict for the symbol 'object'") }) test_that("merging formulas fail when scope conflicts between symbols", { env1 <- new.env(parent = emptyenv()) env1$object <- list() env2 <- new.env(parent = emptyenv()) env2$other_object <- list() f1 <- new_formula(NULL, quote(list(object)), env = env1) f2 <- new_formula(NULL, quote(list(other_object)), env = env2) expect_error(merge_envs(f1, f2), "conflict across symbols") }) test_that("formulas() fails when supplied non-formula objects", { expect_error(formulas(~lhs, NULL), "must contain only formulas") }) test_that("formulas() combines the lhs", { expect_equal(formulas(~lhs, a = ~1, b = other ~ 2), list(a = lhs ~ 1, b = lhs ~ 2)) }) test_that("bytecoded fit_with() works", { bc_fit_with <- compiler::cmpfun(fit_with) fit <- bc_fit_with(mtcars, lm, list(disp ~ drat)) expect_is(fit[[1]], "lm") }) modelr/tests/testthat/test-resampling.R0000644000176200001440000000433013432533345020004 0ustar liggesuserscontext("resampling") suppressPackageStartupMessages(library(dplyr)) suppressPackageStartupMessages(library(purrr)) d <- mtcars %>% head(30) %>% mutate(row = row_number()) test_that("Can perform cross validation", { cross <- crossv_kfold(d, k = 5) expect_equal(nrow(cross), 5) trains <- map(cross$train, as.data.frame) expect_true(all(map_dbl(trains, nrow) == 24)) tests <- map(cross$test, as.data.frame) expect_true(all(map_dbl(tests, nrow) == 6)) overlaps <- map2(map(trains, "row"), map(tests, "row"), intersect) expect_true(all(lengths(overlaps) == 0)) }) test_that("Can perform leave-one-out cross validation", { cross <- crossv_loo(d) expect_equal(nrow(cross), 30) trains <- map(cross$train, as.data.frame) expect_true(all(map_dbl(trains, nrow) == 29)) tests <- map(cross$test, as.data.frame) expect_true(all(map_dbl(tests, nrow) == 1)) overlaps <- map2(map(trains, "row"), map(tests, "row"), intersect) expect_true(all(lengths(overlaps) == 0)) expect_true(cross[nrow(cross),]$.id==nrow(cross)) expect_true(cross[1,]$.id==1) }) test_that("Can perform bootstrapping", { boot <- mtcars %>% bootstrap(5) expect_equal(nrow(boot), 5) for (b in boot$strap) { bd <- as.data.frame(b) expect_equal(nrow(bd), nrow(mtcars)) expect_true(all(bd$mpg %in% mtcars$mpg)) expect_false(all(bd$mpg == mtcars$mpg)) } }) test_that("Can perform permutation", { perm <- mtcars %>% permute(5, mpg) expect_equal(nrow(perm), 5) for (p in perm$perm) { pd <- as.data.frame(p) expect_equal(mtcars$cyl, pd$cyl) expect_equal(mtcars$hp, pd$hp) expect_equal(sort(mtcars$mpg), sort(pd$mpg)) # chance of permutation being the same is basically nil expect_false(all(mtcars$mpg == pd$mpg)) } }) test_that("appropriate args are supplied to resample_*()", { expect_error(resample("mtcars", 1:10), "data frame") expect_error(resample(mtcars, 10), "integer vector") expect_error( resample_permutation(mtcars, c("mpg", "cyl"), idx = 2), "same length" ) expect_error( resample_permutation("mtcars", c("mpg", "cyl"), idx = 1:32), "data frame" ) expect_error( resample_permutation(mtcars, c("mpg", "iris"), idx = 1:32), "vector" ) }) modelr/tests/testthat.R0000644000176200001440000000007012727615525014672 0ustar liggesuserslibrary(testthat) library(modelr) test_check("modelr") modelr/R/0000755000176200001440000000000013432533345011742 5ustar liggesusersmodelr/R/residuals.R0000644000176200001440000000325613275046533014071 0ustar liggesusers#' Add residuals to a data frame #' #' @param data A data frame used to generate the residuals #' @param model,var `add_residuals` takes a single `model`; the #' output column will be called `resid` #' @param ... `gather_residuals` and `spread_residuals` take #' multiple models. The name will be taken from either the argument #' name of the name of the model. #' @param .resid,.model The variable names used by `gather_residuals`. #' @return A data frame. `add_residuals` adds a single new column, #' `.resid`, to the input `data`. `spread_residuals` adds #' one column for each model. `gather_predictions` adds two columns #' `.model` and `.resid`, and repeats the input rows for #' each model. #' @export #' @examples #' df <- tibble::data_frame( #' x = sort(runif(100)), #' y = 5 * x + 0.5 * x ^ 2 + 3 + rnorm(length(x)) #' ) #' plot(df) #' #' m1 <- lm(y ~ x, data = df) #' df %>% add_residuals(m1) #' #' m2 <- lm(y ~ poly(x, 2), data = df) #' df %>% spread_residuals(m1, m2) #' df %>% gather_residuals(m1, m2) add_residuals <- function(data, model, var = "resid") { data[[var]] <- residuals(model, data) data } #' @rdname add_residuals #' @export spread_residuals <- function(data, ...) { models <- tibble::lst(...) for (nm in names(models)) { data[[nm]] <- residuals(models[[nm]], data) } data } #' @rdname add_residuals #' @export gather_residuals <- function(data, ..., .resid = "resid", .model = "model") { models <- tibble::lst(...) df <- purrr::map2(models, .resid, add_residuals, data = data) names(df) <- names(models) dplyr::bind_rows(df, .id = .model) } residuals <- function(model, data) { response(model, data) - stats::predict(model, data) } modelr/R/partition.R0000644000176200001440000000165513623760426014111 0ustar liggesusers#' Generate an exclusive partitioning of a data frame #' #' @param data A data frame #' @param p A named numeric vector giving where the value is the probability #' that an observation will be assigned to that group. #' @family resampling techniques #' @export #' @examples #' ex <- resample_partition(mtcars, c(test = 0.3, train = 0.7)) #' mod <- lm(mpg ~ wt, data = ex$train) #' rmse(mod, ex$test) #' rmse(mod, ex$train) resample_partition <- function(data, p) { if (!is.numeric(p) || length(p) < 2 || !all(has_name(p))) { stop("`p` must be a named numeric vector with at least two values.") } if (abs(sum(p) - 1) > 1e-6) { message("Rescaling `p` to sum to 1.") } # Always rescale so sums exactly to 1 p <- p / sum(p) n <- nrow(data) g <- findInterval(seq_len(n) / n, c(0, cumsum(p)), rightmost.closed = TRUE) idx <- split(seq_len(n), sample(g)) names(idx) <- names(p) map(idx, resample, data = data) } modelr/R/utils.R0000644000176200001440000000133213275066477013240 0ustar liggesusers#' Pipe operator #' #' @name %>% #' @rdname pipe #' @keywords internal #' @export #' @importFrom magrittr %>% #' @usage lhs \%>\% rhs NULL reduce_common <- function(x, msg = "Objects must be identical", operator = identical) { reduce(x, function(.x, .y) { if (!operator(.x, .y)) { stop(msg, call. = FALSE) } .y }) } has_name <- function(x) { nms <- names(x) if (is.null(nms)) { rep(FALSE, length(x)) } else { !(is.na(nms) | nms == "") } } big_mark <- function(x, ...) { mark <- if (identical(getOption("OutDec"), ",")) "." else "," formatC(x, big.mark = mark, ...) } id <- function(n) { width <- nchar(n) sprintf(paste0("%0", width, "d"), seq_len(n)) } modelr/R/model_matrix.R0000644000176200001440000000126713275046533014562 0ustar liggesusers#' Construct a design matrix #' #' This is a thin wrapper around [stats::model.matrix()] which #' returns a tibble. Use it to determine how your modelling formula is #' translated into a matrix, an thence into an equation. #' #' @param data A data frame #' @param formula A modelling formula #' @param ... Other arguments passed onto [stats::model.matrix()] #' @return A tibble. #' @export #' @examples #' model_matrix(mtcars, mpg ~ cyl) #' model_matrix(iris, Sepal.Length ~ Species) #' model_matrix(iris, Sepal.Length ~ Species - 1) model_matrix <- function(data, formula, ...) { out <- stats::model.matrix(formula, data = data, ...) mostattributes(out) <- NULL tibble::as_tibble(out) } modelr/R/geom_ref_line.R0000644000176200001440000000075612730570074014667 0ustar liggesusers#' Add a reference line (ggplot2). #' #' @param h,v Position of horizontal or vertical reference line #' @param size Line size #' @param colour Line colour #' @export geom_ref_line <- function(h, v, size = 2, colour = "white") { if (!missing(h)) { ggplot2::geom_hline(yintercept = h, size = size, colour = colour) } else if (!missing(v)) { ggplot2::geom_vline(xintercept = v, size = size, colour = colour) } else { stop("Must supply one of `h` and `v`.", call. = FALSE) } } modelr/R/cross-validation.R0000644000176200001440000000511013426133222015334 0ustar liggesusers#' Generate test-training pairs for cross-validation #' #' `crossv_kfold` splits the data into `k` exclusive partitions, #' and uses each partition for a test-training split. `crossv_mc` #' generates `n` random partitions, holding out `test` of the #' data for training. `crossv_loo` performs leave-one-out #' cross-validation, i.e., `n = nrow(data)` training partitions containing #' `n - 1` rows each. #' #' @inheritParams resample_partition #' @param n Number of test-training pairs to generate (an integer). #' @param test Proportion of observations that should be held out for testing #' (a double). #' @param id Name of variable that gives each model a unique integer id. #' @return A data frame with columns `test`, `train`, and `.id`. #' `test` and `train` are list-columns containing [resample()] objects. #' The number of rows is `n` for `crossv_mc()`, `k` for `crossv_kfold()` #' and `nrow(data)` for `crossv_loo()`. #' @export #' @examples #' cv1 <- crossv_kfold(mtcars, 5) #' cv1 #' #' library(purrr) #' cv2 <- crossv_mc(mtcars, 100) #' models <- map(cv2$train, ~ lm(mpg ~ wt, data = .)) #' errs <- map2_dbl(models, cv2$test, rmse) #' hist(errs) crossv_mc <- function(data, n, test = 0.2, id = ".id") { if (!is.numeric(n) || length(n) != 1) { stop("`n` must be a single integer.", call. = FALSE) } if (!is.numeric(test) || length(test) != 1 || test <= 0 || test >= 1) { stop("`test` must be a value between 0 and 1.", call. = FALSE) } p <- c(train = 1 - test, test = test) runs <- purrr::rerun(n, resample_partition(data, p)) cols <- purrr::transpose(runs) cols[[id]] <- id(n) tibble::as_data_frame(cols) } #' @export #' @param k Number of folds (an integer). #' @rdname crossv_mc crossv_kfold <- function(data, k = 5, id = ".id") { if (!is.numeric(k) || length(k) != 1) { stop("`k` must be a single integer.", call. = FALSE) } n <- nrow(data) folds <- sample(rep(1:k, length.out = n)) idx <- seq_len(n) fold_idx <- split(idx, folds) fold <- function(test) { list( train = resample(data, setdiff(idx, test)), test = resample(data, test) ) } cols <- purrr::transpose(purrr::map(fold_idx, fold)) cols[[id]] <- id(k) tibble::as_data_frame(cols) } #' @export #' @rdname crossv_mc crossv_loo <- function(data, id = ".id") { n <- nrow(data) idx <- seq_len(n) fold_idx <- split(idx, idx) fold <- function(test) { list( train = resample(data, setdiff(idx, test)), test = resample(data, test) ) } cols <- purrr::transpose(purrr::map(fold_idx, fold)) cols[[id]] <- 1:n tibble::as_data_frame(cols) } modelr/R/predictions.R0000644000176200001440000000412013432533345014405 0ustar liggesusers#' Add predictions to a data frame #' #' @param data A data frame used to generate the predictions. #' @param model `add_predictions` takes a single `model`; #' @param var The name of the output column, default value is `pred` #' @param type Prediction type, passed on to `stats::predict()`. Consult #' `predict()` documentation for given `model` to determine valid values. #' @param ... `gather_predictions` and `spread_predictions` take #' multiple models. The name will be taken from either the argument #' name of the name of the model. #' @param .pred,.model The variable names used by `gather_predictions`. #' @return A data frame. `add_prediction` adds a single new column, #' with default name `pred`, to the input `data`. #' `spread_predictions` adds one column for each model. `gather_predictions` #' adds two columns `.model` and `.pred`, and repeats the input rows for each #' model. #' @export #' @examples #' df <- tibble::data_frame( #' x = sort(runif(100)), #' y = 5 * x + 0.5 * x ^ 2 + 3 + rnorm(length(x)) #' ) #' plot(df) #' #' m1 <- lm(y ~ x, data = df) #' grid <- data.frame(x = seq(0, 1, length = 10)) #' grid %>% add_predictions(m1) #' #' m2 <- lm(y ~ poly(x, 2), data = df) #' grid %>% spread_predictions(m1, m2) #' grid %>% gather_predictions(m1, m2) add_predictions <- function(data, model, var = "pred", type = NULL) { data[[var]] <- predict2(model, data, type = type) data } #' @rdname add_predictions #' @export spread_predictions <- function(data, ..., type = NULL) { models <- tibble::lst(...) for (nm in names(models)) { data[[nm]] <- predict2(models[[nm]], data, type = type) } data } #' @rdname add_predictions #' @export gather_predictions <- function(data, ..., .pred = "pred", .model = "model", type = NULL) { models <- tibble::lst(...) df <- purrr::map2(models, .pred, add_predictions, data = data, type = type) names(df) <- names(models) dplyr::bind_rows(df, .id = .model) } predict2 <- function(model, data, type = NULL) { if (is.null(type)) { stats::predict(model, data) } else { stats::predict(model, data, type = type) } } modelr/R/data.R0000644000176200001440000000203112743766052013001 0ustar liggesusers#' Height and income data. #' #' You might have heard that taller people earn more. Is it true? You can #' try and answer the question by exploring this dataset extracted from the #' \href{https://www.nlsinfo.org}{National Longitudinal Study}, which is #' sponsored by the U.S. Bureau of Labor Statistics. #' #' This contains data as at 2012. #' @format #' \describe{ #' \item{income}{Yearly income. The top two percent of values were averaged #' and that average was used to replace all values in the top range. } #' \item{height}{Height, in feet} #' \item{weight}{Weight, in pounds} #' \item{age}{Age, in years, between 47 and 56.} #' \item{marital}{Marital status} #' \item{sex}{Sex} #' \item{education}{Years of education} #' \item{afqt}{Percentile score on Armed Forces Qualification Test.} #' } "heights" #' Simple simulated datasets #' #' These simple simulated datasets are useful for teaching modelling #' basics. #' #' @name sim NULL #' @rdname sim "sim1" #' @rdname sim "sim2" #' @rdname sim "sim3" #' @rdname sim "sim4" modelr/R/permute.R0000644000176200001440000000653713623760745013571 0ustar liggesusers#' Generate `n` permutation replicates. #' #' A permutation test involves permuting one or more variables in a data set #' before performing the test, in order to break any existing relationships #' and simulate the null hypothesis. One can then compare the true statistic #' to the generated distribution of null statistics. #' #' @inheritParams resample_partition #' @param n Number of permutations to generate. #' @param ... Columns to permute. This supports bare column names or dplyr #' [dplyr::select_helpers] #' @param columns In `permute_`, vector of column names to permute. #' @param .id Name of variable that gives each model a unique integer id. #' #' @return A data frame with `n` rows and one column: `perm` #' @export #' @examples #' #' library(purrr) #' perms <- permute(mtcars, 1000, mpg) #' #' models <- map(perms$perm, ~ lm(mpg ~ wt, data = .)) #' glanced <- map_df(models, broom::glance, .id = "id") #' #' # distribution of null permutation statistics #' hist(glanced$statistic) #' # confirm these are roughly uniform p-values #' hist(glanced$p.value) #' #' # test against the unpermuted model to get a permutation p-value #' mod <- lm(mpg ~ wt, mtcars) #' mean(glanced$statistic > broom::glance(mod)$statistic) #' #' @export permute <- function(data, n, ..., .id = ".id") { columns <- tidyselect::vars_select(colnames(data), ...) permute_(data, n, columns, .id = .id) } #' @rdname permute #' @export permute_ <- function(data, n, columns, .id = ".id") { perm <- purrr::rerun(n, resample_permutation(data, columns)) df <- tibble::data_frame(perm = perm) df[[.id]] <- id(n) df } #' Create a resampled permutation of a data frame #' #' @param data A data frame #' @param columns Columns to be permuted #' @param idx Indices to permute by. If not given, generates them randomly #' #' @return A permutation object; use as.data.frame to convert to a permuted #' data frame #' #' @export resample_permutation <- function(data, columns, idx = NULL) { if (is.null(idx)) { idx <- sample.int(nrow(data)) } if (!is.data.frame(data)) { stop("`data` must be a data frame.", call. = FALSE) } if (!is.character(columns) || !(all(columns %in% colnames(data)))) { stop("`columns` must be a vector of column names in `data`", call. = FALSE) } if (!is.integer(idx) || length(idx) != nrow(data)) { stop("`idx` must be an integer vector with the same length as there are ", "rows in `data`", call. = FALSE ) } structure( list( data = data, columns = columns, idx = idx ), class = "permutation" ) } #' @export print.permutation <- function(x, ...) { n <- length(x$idx) if (n > 10) { id10 <- c(x$idx[1:10], "...") } else { id10 <- x$idx } cat("<", obj_sum.permutation(x), "> ", paste(id10, collapse = ", "), "\n", sep = "" ) } #' @export as.integer.permutation <- function(x, ...) { x$idx } #' @export as.data.frame.permutation <- function(x, ...) { ret <- x$data indices <- x$idx for (col in x$columns) { ret[[col]] <- ret[[col]][indices] } ret } #' @export dim.permutation <- function(x, ...) { c(length(x$idx), ncol(x$data)) } #' @importFrom tibble obj_sum #' @method obj_sum resample #' @export obj_sum.permutation <- function(x, ...) { paste0( "permutation (", paste0(x$columns, collapse = ", "), ") [", big_mark(nrow(x)), " x ", big_mark(ncol(x)), "]" ) } modelr/R/data-grid.R0000644000176200001440000000304013473321473013720 0ustar liggesusers#' Generate a data grid. #' #' To visualise a model, it is very useful to be able to generate an #' evenly spaced grid of points from the data. `data_grid` helps you #' do this by wrapping around [tidyr::expand()]. #' #' @param data A data frame #' @param ... Variables passed on to [tidyr::expand()] #' @param .model A model. If supplied, any predictors needed for the model #' not present in `...` will be filled in with "\link{typical}" values. #' @export #' @seealso [seq_range()] for generating ranges from continuous #' variables. #' @examples #' data_grid(mtcars, vs, am) #' #' # For continuous variables, seq_range is useful #' data_grid(mtcars, mpg = mpg) #' data_grid(mtcars, mpg = seq_range(mpg, 10)) #' #' # If you supply a model, missing predictors will be filled in with #' # typical values #' mod <- lm(mpg ~ wt + cyl + vs, data = mtcars) #' data_grid(mtcars, .model = mod) #' data_grid(mtcars, cyl = seq_range(cyl, 9), .model = mod) data_grid <- function(data, ..., .model = NULL) { if (missing(...) && missing(.model)) { abort("Must supply at least one of `...` and `.model`") } if (missing(...)) { expanded <- NULL } else { expanded <- tidyr::expand(data, ...) } if (is.null(.model)) { return(expanded) } # Generate grid of typical values needed <- setdiff(predictor_vars(.model), names(expanded)) if (length(needed) > 0) { typical_vals <- lapply(data[needed], typical) typical_df <- tidyr::crossing(!!!typical_vals) } else { typical_df <- NULL } tidyr::crossing(expanded, typical_df) } modelr/R/response.R0000644000176200001440000000064112745501265013726 0ustar liggesusersresponse_var <- function(model) { UseMethod("response_var") } #' @export response_var.default <- function(model, data) { stats::formula(model)[[2L]] } predictor_vars <- function(model) { UseMethod("predictor_vars") } #' @export predictor_vars.default <- function(model, data) { all.vars(stats::formula(model)[[3L]]) } response <- function(model, data) { eval(response_var(model), as.data.frame(data)) } modelr/R/resample.R0000644000176200001440000000360113623760404013675 0ustar liggesusers#' A "lazy" resample. #' #' Often you will resample a dataset hundreds or thousands of times. Storing #' the complete resample each time would be very inefficient so this class #' instead stores a "pointer" to the original dataset, and a vector of row #' indexes. To turn this into a regular data frame, call `as.data.frame`, #' to extract the indices, use `as.integer`. #' #' @param data The data frame #' @param idx A vector of integer indexes indicating which rows have #' been selected. These values should lie between 1 and `nrow(data)` #' but they are not checked by this function in the interests of performance. #' @family resampling techniques #' @export #' @examples #' resample(mtcars, 1:10) #' #' b <- resample_bootstrap(mtcars) #' b #' as.integer(b) #' as.data.frame(b) #' #' # Many modelling functions will do the coercion for you, so you can #' # use a resample object directly in the data argument #' lm(mpg ~ wt, data = b) resample <- function(data, idx) { if (!is.data.frame(data)) { stop("`data` must be a data frame.", call. = FALSE) } if (!is.integer(idx)) { stop("`idx` must be an integer vector.", call. = FALSE) } structure( list( data = data, idx = idx ), class = "resample" ) } #' @export print.resample <- function(x, ...) { n <- length(x$idx) if (n > 10) { id10 <- c(x$idx[1:10], "...") } else { id10 <- x$idx } cat("<", obj_sum.resample(x), "> ", paste(id10, collapse = ", "), "\n", sep = "" ) } #' @export as.integer.resample <- function(x, ...) { x$idx } #' @export as.data.frame.resample <- function(x, ...) { x$data[x$idx, , drop = FALSE] } #' @export dim.resample <- function(x, ...) { c(length(x$idx), ncol(x$data)) } #' @importFrom tibble obj_sum #' @method obj_sum resample #' @export obj_sum.resample <- function(x, ...) { paste0("resample [", big_mark(nrow(x)), " x ", big_mark(ncol(x)), "]") } modelr/R/typical.R0000644000176200001440000000277713424144743013550 0ustar liggesusers#' Find the typical value #' #' For numeric, integer, and ordered factor vectors, it returns the median. #' For factors, characters, and logical vectors, it returns the most #' frequent value. If multiple values are tied for most frequent, it returns #' them all. `NA` missing values are always silently dropped. #' #' @param x A vector #' @param ... Arguments used by methods #' @export #' @importFrom stats quantile #' @examples #' # median of numeric vector #' typical(rpois(100, lambda = 10)) #' #' # most frequent value of character or factor #' x <- sample(c("a", "b", "c"), 100, prob = c(0.6, 0.2, 0.2), replace = TRUE) #' typical(x) #' typical(factor(x)) #' #' # if tied, returns them all #' x <- c("a", "a", "b", "b", "c") #' typical(x) #' #' # median of an ordered factor #' typical(ordered(c("a", "a", "b", "c", "d"))) #' typical <- function(x, ...) { UseMethod("typical") } #' @export typical.numeric <- function(x, ...) { stats::median(x, na.rm = TRUE) } #' @export typical.factor <- function(x, ...) { counts <- table(x, exclude = NULL) levels(x)[max(counts) == counts] } #' @export typical.character <- function(x, ...) { counts <- table(x, exclude = NULL) names(counts)[max(counts) == counts] } #' @export typical.logical <- function(x, ...) { mean(x, na.rm = TRUE) >= 0.5 } #' @export typical.integer <- function(x, ...) { unname(stats::quantile(x, 0.5, type = 1, na.rm = TRUE)) } #' @export typical.ordered <- function(x, ...) { as.character(stats::quantile(x, 0.5, type = 1, na.rm = TRUE)) } modelr/R/na-warn.R0000644000176200001440000000160213623760453013433 0ustar liggesusers#' Handle missing values with a warning #' #' This NA handler ensures that those models that support the #' `na.action` parameter do not silently drop missing values. It #' wraps around [stats::na.exclude()] so that there is one #' prediction/residual for input row. To apply it globally, run #' `options(na.action = na.warn)`. #' #' @param object A data frame #' @export #' @examples #' df <- tibble::tibble( #' x = 1:10, #' y = c(5.1, 9.7, NA, 17.4, 21.2, 26.6, 27.9, NA, 36.3, 40.4) #' ) #' # Default behaviour is to silently drop #' m1 <- lm(y ~ x, data = df) #' resid(m1) #' #' # Use na.action = na.warn to warn #' m2 <- lm(y ~ x, data = df, na.action = na.warn) #' resid(m2) na.warn <- function(object) { missing <- sum(!stats::complete.cases(object)) if (missing > 0) { warning("Dropping ", missing, " rows with missing values", call. = FALSE) } stats::na.exclude(object) } modelr/R/formulas.R0000644000176200001440000001276413523022712013717 0ustar liggesusers#' Fit a list of formulas #' #' `fit_with()` is a pipe-friendly tool that applies a list of #' formulas to a fitting function such as [stats::lm()]. #' The list of formulas is typically created with [formulas()]. #' #' Assumes that `.f` takes the formula either as first argument #' or as second argument if the first argument is `data`. Most #' fitting functions should fit these requirements. #' @param data A dataset used to fit the models. #' @param .f A fitting function such as [stats::lm()], #' [lme4::lmer()] or [rstanarm::stan_glmer()]. #' @param .formulas A list of formulas specifying a model. #' @param ... Additional arguments passed on to `.f` #' @seealso [formulas()] #' @export #' @examples #' # fit_with() is typically used with formulas(). #' disp_fits <- mtcars %>% fit_with(lm, formulas(~disp, #' additive = ~drat + cyl, #' interaction = ~drat * cyl, #' full = add_predictors(interaction, ~am, ~vs) #' )) #' #' # The list of fitted models is named after the names of the list of #' # formulas: #' disp_fits$full #' #' # Additional arguments are passed on to .f #' mtcars %>% fit_with(glm, list(am ~ disp), family = binomial) fit_with <- function(data, .f, .formulas, ...) { args <- list(...) # Quoting data to avoid getting the whole raw SEXP structure in the # calls captured by the fitting function (which gets displayed in # print methods) args$data <- quote(data) # Supply .f quoted, otherwise the whole fitting function is inlined # in the call recorded in the fit objects map(.formulas, function(formula) { purrr::invoke(".f", args, formula = formula, .env = environment()) }) } #' Create a list of formulas #' #' `formulas()` creates a list of two-sided formulas by merging a #' unique left-hand side to a list of right-hand sides. #' @param .response A one-sided formula used as the left-hand side of #' all resulting formulas. #' @param ... List of formulas whose right-hand sides will be merged #' to `.response`. #' @export #' @examples #' # Provide named arguments to create a named list of formulas: #' models <- formulas(~lhs, #' additive = ~var1 + var2, #' interaction = ~var1 * var2 #' ) #' models$additive #' #' # The formulas are created sequentially, so that you can refer to #' # previously created formulas: #' formulas(~lhs, #' linear = ~var1 + var2, #' hierarchical = add_predictors(linear, ~(1 | group)) #' ) formulas <- function(.response, ...) { formulas <- tibble::lst(...) validate_formulas(.response, formulas) map(formulas, set_lhs, .response) } #' @rdname formulas #' @export formulae <- formulas validate_formulas <- function(response, formulas) { if (!is_formula(response) || length(response) != 2) { stop(".response must be a one-sided formula", call. = FALSE) } if (!length(formulas)) { stop("No formula provided", call. = FALSE) } purrr::walk(formulas, function(f) { if (!is_formula(f)) { stop("'...' must contain only formulas", call. = FALSE) } }) } set_lhs <- function(f, lhs) { env <- merge_envs(lhs, f) new_formula(f_rhs(lhs), f_rhs(f), env) } #' Add predictors to a formula #' #' This merges a one- or two-sided formula `f` with the #' right-hand sides of all formulas supplied in `...`. #' @param f A formula. #' @param ... Formulas whose right-hand sides will be merged to #' `f`. #' @param fun A function name indicating how to merge the right-hand #' sides. #' @export #' @examples #' f <- lhs ~ rhs #' add_predictors(f, ~var1, ~var2) #' #' # Left-hand sides are ignored: #' add_predictors(f, lhs1 ~ var1, lhs2 ~ var2) #' #' # fun can also be set to a function like "*": #' add_predictors(f, ~var1, ~var2, fun = "*") add_predictors <- function(f, ..., fun = "+") { rhss <- map(list(f, ...), f_zap_lhs) rhs <- reduce(rhss, merge_formulas, fun = fun) env <- merge_envs(f, rhs) new_formula(f_lhs(f), f_rhs(rhs), env) } merge_formulas <- function(f1, f2, fun = "+") { rhs <- call(fun, f_rhs(f1), f_rhs(f2)) lhss <- compact(map(list(f1, f2), f_lhs)) if (length(lhss) == 0) { lhs <- NULL } else { lhs <- reduce_common(lhss, "Left-hand sides must be identical") } env <- merge_envs(f1, f2) new_formula(lhs, rhs, env) } merge_envs <- function(f1, f2) { symbols_f1 <- find_symbols(f1) symbols_f2 <- find_symbols(f2) conflicts <- intersect(symbols_f1, symbols_f2) conflicts_envs <- compact(map(conflicts, find_env_conflicts, f1, f2)) all_symbols <- union(symbols_f1, symbols_f2) nonconflicts <- setdiff(all_symbols, conflicts) nonconflicts_envs <- compact(map(nonconflicts, find_env_nonconflicts, f1, f2)) all_envs <- c(conflicts_envs, nonconflicts_envs) if (length(all_envs) == 0) { environment(f1) } else { reduce_common( all_envs, "Cannot merge formulas as their scopes conflict across symbols" ) } } find_env_conflicts <- function(symbol, f1, f2) { env1 <- find_binding_env(symbol, environment(f1)) env2 <- find_binding_env(symbol, environment(f2)) if (is.null(env1) || is.null(env2)) { return(env1 %||% env2) } if (!identical(env1, env2)) { stop("Cannot merge formulas as their scopes conflict for the symbol '", symbol, "'", call. = FALSE ) } env1 } find_env_nonconflicts <- function(symbol, f1, f2) { env1 <- find_binding_env(symbol, environment(f1)) env2 <- find_binding_env(symbol, environment(f2)) env1 %||% env2 } find_binding_env <- function(symbol, env) { if (exists(symbol, envir = env)) { env } else if (!identical(env, emptyenv())) { find_binding_env(symbol, parent.env(env)) } else { NULL } } modelr/R/utils-lang.R0000644000176200001440000000113213275066351014144 0ustar liggesusers find_symbols <- function(lang) { if (is.call(lang)) { find_symbols_call(lang) } else if (is.symbol(lang)) { as.character(lang) } else { character(0) } } find_symbols_call <- function(lang) { fun_name <- as.character(lang[[1]]) if (fun_name %in% c("$", "@")) { as.character(lang[[2]]) } else if (fun_name %in% c("::", ":::")) { character(0) } else { res <- map(as.list(lang[-1]), find_symbols) purrr::flatten_chr(res) } } f_zap_lhs <- function(f) { new_formula(NULL, f_rhs(f), env = f_env(f)) } is_formula <- function(f) { inherits(f, "formula") } modelr/R/seq_range.R0000644000176200001440000000352013275064740014034 0ustar liggesusers#' Generate a sequence over the range of a vector #' #' @param x A numeric vector #' @param n,by Specify the output sequence either by supplying the #' length of the sequence with `n`, or the spacing between value #' with `by`. Specifying both is an error. #' #' I recommend that you name these arguments in order to make it clear to #' the reader. #' @param pretty If `TRUE`, will generate a pretty sequence. If `n` #' is supplied, this will use [pretty()] instead of #' [seq()]. If `by` is supplied, it will round the first #' value to a multiple of `by`. #' @param trim Optionally, trim values off the tails. #' `trim / 2 * length(x)` values are removed from each tail. #' @param expand Optionally, expand the range by `expand * (1 + range(x)` #' (computed after trimming). #' @export #' @examples #' x <- rcauchy(100) #' seq_range(x, n = 10) #' seq_range(x, n = 10, trim = 0.1) #' seq_range(x, by = 1, trim = 0.1) #' #' # Make pretty sequences #' y <- runif(100) #' seq_range(y, n = 10) #' seq_range(y, n = 10, pretty = TRUE) #' seq_range(y, n = 10, expand = 0.5, pretty = TRUE) #' #' seq_range(y, by = 0.1) #' seq_range(y, by = 0.1, pretty = TRUE) seq_range <- function(x, n, by, trim = NULL, expand = NULL, pretty = FALSE) { if (!missing(n) && !missing(by)) { stop("May only specify one of `n` and `by`", call. = FALSE) } if (!is.null(trim)) { rng <- stats::quantile(x, c(trim / 2, 1 - trim / 2), na.rm = TRUE) } else { rng <- range(x, na.rm = TRUE) } if (!is.null(expand)) { rng <- rng + c(-expand / 2, expand / 2) * (rng[2] - rng[1]) } if (missing(by)) { if (pretty) { pretty(rng, n) } else { seq(rng[1], rng[2], length.out = n) } } else { if (pretty) { rng[1] <- floor(rng[1] / by) * by rng[2] <- ceiling(rng[2] / by) * by } seq(rng[1], rng[2], by = by) } } modelr/R/quality.R0000644000176200001440000000400213275064735013560 0ustar liggesusers#' Compute model quality for a given dataset #' #' @description #' Three summaries are immediately interpretible on the scale of the response #' variable: #' * `rmse()` is the root-mean-squared-error #' * `mae()` is the mean absolute error #' * `qae()` is quantiles of absolute error. #' #' Other summaries have varying scales and interpretations: #' * `mape()` mean absolute percentage error. #' * `rsae()` is the relative sum of absolute errors. #' * `mse()` is the mean-squared-error. #' * `rsquare()` is the variance of the predictions divided by the #' variance of the response. #' @param model A model #' @param data The dataset #' @name model-quality #' @examples #' mod <- lm(mpg ~ wt, data = mtcars) #' mse(mod, mtcars) #' rmse(mod, mtcars) #' rsquare(mod, mtcars) #' mae(mod, mtcars) #' qae(mod, mtcars) #' mape(mod, mtcars) #' rsae(mod, mtcars) NULL #' @export #' @rdname model-quality mse <- function(model, data) { x <- residuals(model, data) mean(x^2, na.rm = TRUE) } #' @export #' @rdname model-quality rmse <- function(model, data) { x <- residuals(model, data) sqrt(mean(x^2, na.rm = TRUE)) } #' @export #' @rdname model-quality mae <- function(model, data) { x <- residuals(model, data) mean(abs(x), na.rm = TRUE) } #' @export #' @rdname model-quality rsquare <- function(model, data) { x <- residuals(model, data) y <- response(model, data) 1 - stats::var(x, na.rm = TRUE) / stats::var(y, na.rm = TRUE) } #' @export #' @rdname model-quality #' @param probs Numeric vector of probabilities qae <- function(model, data, probs = c(0.05, 0.25, 0.5, 0.75, 0.95)) { x <- residuals(model, data) stats::quantile(abs(x), probs, na.rm = TRUE) } #' @export #' @rdname model-quality mape <- function(model, data) { x <- residuals(model, data) y <- response(model, data) mean(abs(x / y), na.rm = TRUE) } #' @export #' @rdname model-quality rsae <- function(model, data) { x <- residuals(model, data) y <- response(model, data) miss <- is.na(x) | is.na(y) sum(abs(x[!miss])) / sum(abs(y[!miss])) } modelr/R/bootstrap.R0000644000176200001440000000224513623760426014111 0ustar liggesusers#' @importFrom broom tidy NULL #' Generate `n` bootstrap replicates. #' #' @inheritParams resample_partition #' @family resampling techniques #' @param n Number of bootstrap replicates to generate #' @param id Name of variable that gives each model a unique integer id. #' @return A data frame with `n` rows and one column: `strap` #' @export #' @examples #' library(purrr) #' boot <- bootstrap(mtcars, 100) #' #' models <- map(boot$strap, ~ lm(mpg ~ wt, data = .)) #' tidied <- map_df(models, broom::tidy, .id = "id") #' #' hist(subset(tidied, term == "wt")$estimate) #' hist(subset(tidied, term == "(Intercept)")$estimate) bootstrap <- function(data, n, id = ".id") { bootstrap <- purrr::rerun(n, resample_bootstrap(data)) df <- tibble::data_frame(strap = bootstrap) df[[id]] <- id(n) df } #' Generate a boostrap replicate #' #' @param data A data frame #' @family resampling techniques #' @export #' @examples #' coef(lm(mpg ~ wt, data = resample_bootstrap(mtcars))) #' coef(lm(mpg ~ wt, data = resample_bootstrap(mtcars))) #' coef(lm(mpg ~ wt, data = resample_bootstrap(mtcars))) resample_bootstrap <- function(data) { resample(data, sample(nrow(data), replace = TRUE)) } modelr/R/modelr.R0000644000176200001440000000013213275066562013352 0ustar liggesusers#' @keywords internal #' @import rlang #' @importFrom purrr map reduce compact "_PACKAGE" modelr/NEWS.md0000644000176200001440000000247713624310507012645 0ustar liggesusers# modelr 0.1.6 * R CMD check documentation fix # modelr 0.1.5 * Fix to `data_grid()` to work with dev tidyr. # modelr 0.1.4 * `add_predictions()`, `gather_predictions()`, and `spread_predictions()` more carefully pass along `type` parameter in order to avoid problems with predict methods that don't deal with `type = NULL` (#92). # modelr 0.1.3 * `add_predictions()`, `gather_predictions()`, and `spread_predictions()` gain a `type` parameter which is passed through to `stats::predict()` (#34, @pmenzel) * New `crossv_loo()` which implements leave-one-out cross validation (@pmenzel) * `typical()` no longer ignores missing values in character and factor vectors (#80). # modelr 0.1.2 * `data_grid()` no longer fails with modern tidyr (#58). * New `mape()` and `rsae()` model quality statistics (@paulponcet, #33). * `rsquare()` use more robust calculation 1 - SS_res / SS_tot rather than SS_reg / SS_tot (#37). * `typical()` gains `ordered` and `integer` methods (@jrnold, #44), and `...` argument (@jrnold, #42). # modelr 0.1.1 * Added a `NEWS.md` file to track changes to the package. * Fixed R CMD CHECK note * Updated usage of `reduce()` for upcoming purrr release * More general `permute()` function * Add `mse()` function to calculate mean squared error. Written by @bensoltoff, pull request #57 modelr/MD50000644000176200001440000000676213624321012012051 0ustar liggesusers5c9099322eefe8e571f74cf414bb9133 *DESCRIPTION 0f89eda47110df4df47fd1dba96164b7 *NAMESPACE 1e92b91d791731c21987f152928c638e *NEWS.md 1131eef92f7f84719bdd1051449db010 *R/bootstrap.R a3c0de9d45faae18434474076cc71fe6 *R/cross-validation.R 4048ae38f05339d6e9bfe2a6800164de *R/data-grid.R 9f831f87851514705fcc85de24203d15 *R/data.R 420b53e0ef033149b6528a73ece7e86c *R/formulas.R 860d3015670806ae1ca2bb0126cb4f30 *R/geom_ref_line.R c295edea21a5d0ad9398c8d3024aa28e *R/model_matrix.R 80caf47b8eaeedd005159869d4b059ca *R/modelr.R e512f3182937a44cdf5e3c5ceba515c2 *R/na-warn.R 3ab1b184d634a571c5e035d1d9037dfb *R/partition.R 52088ac1ed7748b86df840ef6d705ea1 *R/permute.R 806cf26bac215551d75dec6250821da9 *R/predictions.R 5484a5498231d7334bcfd45702caf9d7 *R/quality.R f3814bc88ea1b450a8f1aa9e02c8b791 *R/resample.R eedbff0f41f7ac012a579dd40e6bd63f *R/residuals.R 59cabddf9b6c6fd5d35861c3e3e87965 *R/response.R 13fd320516289e9a497c96e615f146ab *R/seq_range.R 843e132e24b903ccc1803cdbfb76eb26 *R/typical.R 84a5593d723a4755bb953a2265a2d0ea *R/utils-lang.R 54df7e2f3bf9867e796647bc64fd0689 *R/utils.R 0a4a79f747bd3ea6fee61b7d3a9d3992 *README.md c040b7762c2934fcc667a3495ad57efe *data/heights.rda ffd5f438ae67195a4c2fa23dd922a910 *data/sim1.rda c155c78849583d02713d189068309762 *data/sim2.rda 59dd96e016540fff1dfcf80e8e272f6d *data/sim3.rda d23f65ae7f994af283efe25552834512 *data/sim4.rda 8f8706cd31549cba2505518e4239385c *man/add_predictions.Rd 7e97d3e5d60052d420f3eda09b4d4458 *man/add_predictors.Rd f890c98a68b419cd0a41a6a19fad21c3 *man/add_residuals.Rd 2fde57e43c3955214fa7194f1f3e6b15 *man/bootstrap.Rd 6a068f157dea6ef502387e29b56d4ee9 *man/crossv_mc.Rd 76328b06d97f86b454394a79823dd360 *man/data_grid.Rd b8e4e18572591ce4e1940f99c014c169 *man/figures/logo.png e68f8d24aac345896821924195bcd88f *man/fit_with.Rd 5e759a1d727767ad088b12760366cb73 *man/formulas.Rd e659fadd7e9db15c3c6d901e7792f8bc *man/geom_ref_line.Rd 8d281cffe0bb4e27f927a670ebfd0704 *man/heights.Rd 8954d829b720ddf45c08ed0be8346e88 *man/model-quality.Rd 2df8c25cd25bcb4aa0f15689cd7d2894 *man/model_matrix.Rd 7b97e8e1f3c0958a0d7b5602a90f8857 *man/modelr-package.Rd d6194cd16732fde87e095b8ce42bec2a *man/na.warn.Rd 843bd305d0057e9b88a2a764f082f518 *man/permute.Rd a64a7ea44fcaa33c2d3ad0f7909cbc3e *man/pipe.Rd 133bf62781d8778baccbca1377307199 *man/resample.Rd 10df1fda7a9940500f8ce931af501c8a *man/resample_bootstrap.Rd 0d11d9a8e08c8b00003309cdf6603733 *man/resample_partition.Rd 018ffd02efe6cbf3ec2543204055e4e6 *man/resample_permutation.Rd c490d6cefdb2acf4aeb882a29e9280a1 *man/seq_range.Rd 2f1c1034dd00234c971b4399ccf3306e *man/sim.Rd b0df1ae92c7d48be1e445b2100a0587e *man/typical.Rd daad45bf0c55617791ef8c4e34ffa1ac *tests/testthat.R d6390d64b8f2d2186c557d9933ae9022 *tests/testthat/test-cross-validate.R 96da272add6d9cb6ace6c9d732ff1656 *tests/testthat/test-data-grid.R 0723f1e80ab9bca4202f8c2ce9f0241a *tests/testthat/test-formulas.R 08082a2003ce4ec51583f0a92f73cc17 *tests/testthat/test-geom-ref-line.R d9fda079bc21f8b33faec5de059a94ad *tests/testthat/test-model-matrix.R 11e11a68bfd2544ad244365d12f8690a *tests/testthat/test-na-warn.R 4ace4ced4e16ef74e28841e6bb4b285f *tests/testthat/test-predictions.R f43c5155ffcb4f0b9e74947aa9125cc3 *tests/testthat/test-resample-partition.R 9affdb3f9bd8d7757649e4beb0f321a7 *tests/testthat/test-resampling.R cb1c6aa89432e65ab203ccc6c1bccabb *tests/testthat/test-residuals.R a02473ea3b8b81c79ebf27d65eed3b93 *tests/testthat/test-response_var.R b53aa97e7b04d0f9208813665cdba81b *tests/testthat/test-seq-range.R 0304fd73e3278a25ca1f382f1680539d *tests/testthat/test-typical.R