coef: Coef method for GeDS objects

Description Usage Arguments Details Value See Also Examples

Description

Methods for the functions coef and coefficients that allow to extract the estimated coefficients of a fitted GeDS regression from a GeDS-Class object.

Usage

1
2
3
4
5
## S3 method for class 'GeDS'
coef(object, n = 3L, onlySpline = TRUE, ...)

## S3 method for class 'GeDS'
coefficients(object, n = 3L, onlySpline = TRUE, ...)

Arguments

object

the GeDS-class object from which the coefficients of the selected GeDS regression should be extracted.

n

integer value (2, 3 or 4) specifying the order (= degree + 1) of the GeDS fit whose coefficients should be extracted. By default equal to 3L. Non-integer values will be passed to the function as.integer.

onlySpline

logical variable specifying whether only the coefficients for the GeDS component of the fitted multivariate regression model should be extracted or alternatively also the coefficients of the parametric component should also be extracted.

...

potentially further arguments (required by the definition of the generic function). They will be ignored, but with a warning.

Details

These are simple methods for the functions coef and coefficients.

As GeDS-class objects contain three different fits (linear, quadratic and cubic), it is possible to specify the order of the fit for which GeDS regression coefficients are required via the input argument n.

As mentioned in the details of formula, the predictor model may be multivariate and it may include a GeD spline component whereas the remaining variables may be part of a parametric component. If the onlySpline argument is set to TRUE (the default value), only the coefficients corresponding to the GeD spline component of order n of the multivariate predictor model are extracted.

Value

A named vector containing the required coefficients of the fitted multivariate predictor model. The coefficients corresponding to the variables that enter the parametric component of the fitted multivariate predictor model are named as the variables themselves. The coefficients of the GeDS component are coded as "N" followed by the index of the corresponding B-spline.

See Also

coef for the standard definition; NGeDS for examples.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Generate a data sample for the response variable
# and the covariates
set.seed(123)
N <- 500
f_1 <- function(x) (10*x/(1+100*x^2))*4+4
X <- sort(runif(N ,min = -2, max = 2))
Z <- runif(N)
# Specify a model for the mean of the response Y to be a superposition of
# a non-linear component f_1(X), a linear component 2*Z and a
# free term 1, i.e.
means <- f_1(X) + 2*Z + 1
# Add normal noise to the mean of y
Y <- rnorm(N, means, sd = 0.1)

# Fit to this sample a predictor model of the form f(X) + Z, where
# f(X) is the GeDS component and Z is the linear (additive) component
# see ?formula.GeDS for details
(Gmod <- NGeDS(Y ~ f(X) + Z, beta = 0.6, phi = 0.995, Xextr = c(-2,2)))

# Extract the GeD spline regression coefficients
coef(Gmod, n = 3)

# Extract all the coefficients, including the one for the linear component
coef(Gmod, onlySpline = FALSE, n = 3)

GeDS documentation built on May 2, 2019, 12:36 p.m.