View source: R/leave_one_out.R
leave_one_out | R Documentation |
Computes the leave-one-out cross-validated predictions from a model fit, assuming Gaussian-distributed response with identity link.
leave_one_out(model_fit)
model_fit |
A fitted Lagrangian smoothing spline model |
A vector of leave-one-out cross-validated predictions
## Basic usage with Gaussian response, computing PRESS
set.seed(1234)
t <- rnorm(50)
y <- sin(t) + rnorm(50, 0, .25)
fit <- lgspline(t, y)
loo <- leave_one_out(fit)
press <- mean((y-loo)^2)
plot(loo, y,
main = "Leave-One-Out Cross-Validation Prediction vs. Observed Response",
xlab = 'Prediction', ylab = 'Response')
abline(0, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.