loocv | R Documentation |
This function calculates root mean squared error (RMSE) for leave-one-out cross-validation of linear regression estimated via least squares method.
loocv(fit)
fit |
object of class |
Fast analytical formula is used.
This function returns a numeric value representing root mean squared error (RMSE) of leave-one-out cross-validation (LOOCV).
set.seed(123)
# Generate data according to linear regression
n <- 100
eps <- rnorm(n)
x <- runif(n)
y <- x + eps
# Estimate the model
model <- lm(y ~ x)
# Perform cross-validation
loocv(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.