MyNixOS website logo
Description

Cross-Validating Regression Models.

Cross-validation methods of regression models that exploit features of various modeling functions to improve speed. Some of the methods implemented in the package are novel, as described in the package vignettes; for general introductions to cross-validation, see, for example, Gareth James, Daniela Witten, Trevor Hastie, and Robert Tibshirani (2021, ISBN 978-1-0716-1417-4, Secs. 5.1, 5.3), "An Introduction to Statistical Learning with Applications in R, Second Edition", and Trevor Hastie, Robert Tibshirani, and Jerome Friedman (2009, ISBN 978-0-387-84857-0, Sec. 7.10), "The Elements of Statistical Learning, Second Edition".

R-CMD-check Lifecycle: stable Last Commit CRAN metacran downloads

cv package for R: Cross-Validating Regression Models

The cv package for R provides a consistent and extensible framework for cross-validating standard R statistical models. Some of the functions supplied by the package:

  • cv() is a generic function with a default method, computationally efficient "lm" and "glm" methods, an "rlm" method (for robust linear models), and a method for a list of competing models. There are also "merMod", "lme", and "glmmTMB" methods for mixed-effects models. cv() supports parallel computations.

  • mse() (mean-squared error), rmse() (root-mean-squared error), medAbsErr() (median absolute error), and BayesRule() are cross-validation criteria ("cost functions"), suitable for use with cv().

  • cv() also can cross-validate a selection procedure (such as the following) for a regression model:

    • cvModelList() employs CV to select a model from among a number of candidates, and then cross-validates this model-selection procedure.

    • selectStepAIC() is a predictor-selection procedure based on the stepAIC() function in the MASS package.

    • selectTrans() is a procedure for selecting predictor and response transformations in regression, based on the powerTransform() function in the car package.

    • selectTransStepAIC() is a procedure that first selects predictor and response transformations and then selects predictors.

For additional introductory information on using the cv package, see the "Cross-validating regression models" vignette (vignette("cv", package="cv")). There are also vignettes on cross-validating mixed-effects models (vignette("cv-mixed", package="cv")), cross-validating model selection (vignette("cv-selection", package="cv")), and computational and technical notes (vignette("cv-notes", package="cv")). The cv package is designed to be extensible to other classes of regression models, other CV criteria, and other model-selection procedures; for details, see the "Extending the cv package" vignette (vignette("cv-extend", package="cv")).

Installing the cv package

To install the current version of the cv package from CRAN:

install.packages("cv")

To install the development version of the cv package from GitHub:

if (!require(remotes)) install.packages("remotes")
remotes::install_github("gmonette/cv", build_vignettes=TRUE,
  dependencies=TRUE)
Metadata

Version

2.0.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows