What is cv.lm() function?

cv.lm() function is defined under the DAAG package which is used for k-fold validation.

Description. This function gives internal and cross-validation measures of predictive accuracy for ordinary linear regression. The data are randomly assigned to a number of `folds’. Each fold is removed, in turn, while the remaining data is used to re-fit the regression model and to predict at the deleted observations.

Description

This function gives internal and cross-validation measures of predictive accuracy for ordinary linear regression. The data are randomly assigned to a number of `folds’. Each fold is removed, in turn, while the remaining data is used to re-fit the regression model and to predict at the deleted observations.

Usage

cv.lm(df = houseprices, form.lm = formula(sale.price ~ area), m=3, dots = FALSE, seed=29, plotit=TRUE, printit=TRUE)

Arguments

df

a data frame

form.lm

a formula object

m

the number of folds

dots

uses pch=16 for the plotting character

seed

random number generator seed

plotit

if TRUE, a plot is constructed on the active device

printit

if TRUE, output is printed to the screen

Value

  • ssthe cross-validation residual sum of squares
  • dfdegrees of freedom