View source: R/S3methods_GeDSboost-GeDSgam.R
coef.GeDSgam,boost | R Documentation |
Method for the function coef
that allows to extract the
estimated coefficients of a "GeDSgam"
class or "GeDSboost"
class
object.
## S3 method for class 'GeDSgam'
coef(object, n = 3L, ...)
## S3 method for class 'GeDSboost'
coef(object, n = 3L, ...)
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. |
A named vector containing the required coefficients of the fitted multivariate predictor model.
coef
for the standard definition;
NGeDSgam
and NGeDSboost
for 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)`
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.