leave_one_out {lgspline} | R Documentation |
Compute Leave-One-Out Cross-Validated predictions for Gaussian Response/Identity Link under Constraint.
Description
Computes the leave-one-out cross-validated predictions from a model fit, assuming Gaussian-distributed response with identity link.
Usage
leave_one_out(model_fit)
Arguments
model_fit |
A fitted Lagrangian smoothing spline model |
Value
A vector of leave-one-out cross-validated predictions
Examples
## 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)
[Package lgspline version 0.2.0 Index]