coef.GeDSgam,boost {GeDS} | R Documentation |
Coef Method for GeDSgam, GeDSboost
Description
Method for the function coef
that allows to extract the
estimated coefficients of a "GeDSgam"
class or "GeDSboost"
class
object.
Usage
## S3 method for class 'GeDSgam'
coef(object, n = 3L, ...)
## S3 method for class 'GeDSboost'
coef(object, n = 3L, ...)
Arguments
object |
The |
n |
Integer value (2, 3 or 4) specifying the order (
By default |
... |
Potentially further arguments (required by the definition of the generic function). These will be ignored, but with a warning. |
Value
A named vector containing the required coefficients of the fitted multivariate predictor model.
See Also
coef
for the standard definition;
NGeDSgam
and NGeDSboost
for examples.
Examples
data(mtcars)
# Convert specified variables to factors
categorical_vars <- c("cyl", "vs", "am", "gear", "carb")
mtcars[categorical_vars] <- lapply(mtcars[categorical_vars], factor)
Gmodgam <- NGeDSgam(mpg ~ f(disp, hp) + f(qsec) + carb,
data = mtcars, family = gaussian, phi = 0.7)
# Piecewise polynomial coefficients of the (univariate) GeDS and linear learners
coef(Gmodgam, n = 2)$`f(qsec)`
coef(Gmodgam, n = 2)$carb
# B-spline coefficients of the bivariate learner
coef(Gmodgam, n = 2)$`f(disp, hp)`
Gmodboost <- NGeDSboost(mpg ~ f(disp, hp) + f(qsec) + carb,
data = mtcars, family = mboost::Gaussian(), shrinkage = 0.7)
# Piecewise polynomial coefficients of the (univariate) GeDS and linear learners
coef(Gmodboost, n = 2)$`f(qsec)`
coef(Gmodboost, n = 2)$carb
# B-spline coefficients of the bivariate learner at each boosting iteration
# this was selected
coef(Gmodboost, n = 2)$`f(disp, hp)`