Effective degrees of freedom for smooth terms
Extracts the effective degrees of freedom (EDF) for model smooth terms
edf(object, ...) ## S3 method for class 'gam' edf(object, smooth = NULL, alternative = FALSE, ...)
object |
a fitted model from which to extract smooth-specific EDFs. |
... |
arguments passed to methods. |
smooth |
character; a vector of smooth terms whose EDFs will be
extracted. If |
alternative |
logical; return the alternative form for model EDFs of Wood (2017; pp. 252). |
Wood (2017; pp. 252) describes an alternative EDF describes an alternative EDF form for the entire model
EDF = 2 * tr(F) - tr(F),
where \mathrm{tr} is the matrix trace and F is a matrix mapping un-penalized coefficient estimates to the penalized coefficient estimates. The trace of F is effectively the average shrinkage of the coefficients multipled by the number of coefficients (Wood, 2017). Smooth-specific EDFs then are obtained by summing up the relevent elements of \mathrm{diag}(2\mathbf{F} - \mathbf{FF}).
load_mgcv() df <- data_sim("eg1", n = 400, seed = 42) m <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = df, method = "REML") edf(m) edf(m, smooth = c("s(x0)", "s(x2)"))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.