Description Usage Arguments Value Author(s) References See Also Examples
Calculates the generalized cross-validation score given number of observations, model deviance, effective degrees of freedom and gamma.
1 | lossGCV(n, Dev, trA, gammaPar=1)
|
n |
Number of observations (integer scalar). |
Dev |
Deviance of the kernel ridge regression (numeric scalar). |
trA |
Effective degrees of freedom (numeric scalar). |
gammaPar |
Weighting parameter (numeric scalar), which specifies how the generalized cross-validation score is penalized by the effective degrees of freedom. Default value is 1. |
Generalized cross-validation loss (numeric scalar).
Thomas Welchowski welchow@imbie.meb.uni-bonn.de
Simon N. Wood, (2006), Generalized Additive Models: An Introduction with R, Taylor \& Francis Group LLC
lossApprox
, lossCvKDSN
, lossSharedCvKDSN
,
lossSharedTestKDSN
1 2 3 4 5 6 7 | # Simple example based on help pages of mgcv::gam
# GCV Score is the same as used in function mgcv::mgcv
library(mgcv)
dat <- gamSim(1, n=100, dist="normal", scale=2)
gamMod <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat)
calcGCV <- lossGCV(n=100, Dev=deviance(gamMod), trA=sum(gamMod$edf), gammaPar=1)
all.equal(calcGCV, gamMod$gcv.ubre) # TRUE
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.