bbs: P-Spline Base-Learner for CoxFlexBoost

Description Usage Arguments Details Value Note References See Also Examples

View source: R/bbs.R

Description

Defines a P-spline base-learner for boosting flexible, structured survival models. Both, time-constant base-learners and time-varying effects (and thus the baseline hazard) can be specified.

Usage

1
2
3
bbs(x, z = NULL, knots = 20, degree = 3, differences = 2, df = 4,
    center = FALSE, xname = NULL, zname = NULL, timedep = FALSE)
bbsTime(...)

Arguments

x

factor or numeric. A vector containing data.

z

factor or numeric. A vector containing data.

knots

a single numerical value defines the number of equidistant interior knots of the P-spline, a vector defines the knots itself, or NULL, in which case the number of interior knots is choosen to be min(\code{length(x)},40).

degree

degree of the P-spline.

differences

order of the difference penalty used for the P-spline. Accepted values are 1,2 and 3.

df

degrees of freedom. Used to specify the smoothness of the base-learner. Lower values for df correspond to smoother (i.e., “weaker”) base-learners. For details see Hofner et al.

center

logic. If center=TRUE, the corresponding effect is re-parameterized such that the unpenalized part of the fit is substracted and only the deviation from the parametric, unpenalized part is fitted. The unpenalized part(s) have to be included as separate base-learners using bols or bolsTime. See Kneib et al. for details.

xname

optional. Name of the variable given in x.

zname

optional. Name of the variable given in z.

timedep

logic. If timedep = TRUE the base-learner is taken to be time-dependent, i.e., x must be a time. For more details see below.

...

further arguments passed to bbs.

Details

The function bbsTime(...) is a wrapper to bbs(..., timedep=TRUE).

Time-dependent base-learners can be utilzed to specify the (log-) baseline hazard rate or time-varying effects. In the first case, the base-learner is specified as bbsTime(time, z = NULL, ...) and in the later case, the covariate with a (potential) time-dependent effect is specified as z.

In most settings the number of knots should not exceed 20, to keep the computational burden in a reasonable dimension. Thus, a warning is issued if more knots are used.

Value

An object of class baselearner (and class bbs) is returned. It consits of the design matrix of the base-learner. Further elements are returned as attributes (see attr) of the object.

The attributes are mainly for internal use. They consist, for example, of the degrees of freedom df. The corresponding value for lambda and the penalty (pen) are stored as further attributes. The current coefficient estimates are stored in the base-learner as attr(...,"coefs").

Note

The degrees of freedom df are used to compute the corresponding smoothing parameter for the used P-spline. For more details see Hofner et al..

References

Benjamin Hofner, Torsten Hothorn and Thomas Kneib (2008), Variable Selection and Model Choice in Structured Survival Models. Department of Statistics, Technical Report No. 43. http://epub.ub.uni-muenchen.de/7901/

Thomas Kneib, Torsten Hothorn and Gerhard Tutz (2008), Variable selection and model choice in geoadditive regression models. Biometrics. To appear. http://epub.ub.uni-muenchen.de/2063/

See Also

bols for linear base-learners and cfboost for the boosting algorithm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
x1 <- rnorm(100)
time <- rexp(100,1)
event <- sample(c(0,1), 100, replace=TRUE)
y <- Surv(time,event)

## example for time-constant base-learner
str(bbs(x1, knots = 20, df = 4))

## decomposition of a base-learner
decomp <- y ~ bols(x1) + bbs(x1,knots = 20, df = 1, center = TRUE)

## P-spline base-learner for the (log) baseline hazard
str(bbsTime(time)) # the same as bbs(time, timedep=TRUE)

## example for time-varying effect for x1
str(bbsTime(time, z = x1))

## decomposition of a time-varying effect
decomp <- y ~ bolsTime(time, z = x1) + bbsTime(time, z = x1, df = 1, center = TRUE)

CoxFlexBoost documentation built on May 2, 2019, 6:53 p.m.