load_mgcv()
# \dontshow{
op <- options(cli.unicode = FALSE, pillar.sigfig = 5)
# }
df <- data_sim("eg1", n = 400, seed = 42)
m <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = df, method = "REML")
# extract the EDFs for all smooths
edf(m)
# or selected smooths
edf(m, select = c("s(x0)", "s(x2)"))
# accounting for smoothness parameter uncertainty
edf(m, type = "unconditional")
# over EDF of the model, including the intercept
model_edf(m)
# can get model EDF for multiple models
m2 <- gam(y ~ s(x0) + s(x1) + s(x3), data = df, method = "REML")
model_edf(m, m2)
# \dontshow{
options(op)
# }
Run the code above in your browser using DataLab