int.approx: Approximation of a Cox likelihood intergral

Description Usage Arguments Value Author(s) See Also Examples

View source: R/helpers.R

Description

The function approximates the integral \int_0^t exp(u B(s) α) ds) which appears in the (full) Cox likelihood if the covariate u has a time-varying effect β(t), which is expanded in B-splines, i.e. β(t) = B(t) α.

Usage

1
int.approx(z,time.grid,B,nbasis,alpha)

Arguments

z

a vector which contains at the first component a time point up to which it should be integrated and the covariates u in the remaining components.

time.grid

an equally-spaced time grid on which the B-spline design matrix B has been generated. The maximal value of the time grid should usually be the maximal upper integral border that is of interest.

B

a B-spline design matrix, which has been created with the function bs.design on the full time grid time.grid.

nbasis

number of basis functions used when the B-spline design matrix B has been generated.

alpha

vector of B-spline coefficients.

Value

The B-spline design matrix is returned.

Author(s)

Andreas Groll groll@math.lmu.de

See Also

pencoxfrail

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## generate time grid and corresponding B-spline design matrix
time.grid <- seq(0,200,by=1)
B <- bs.design(x=time.grid, xl=min(time.grid), xr=max(time.grid), spline.degree=3, nbasis=5)

## specify spline coefficients and covariate vector (with upper integral bound as first component)
alpha <- c(0.1,0.2,0.05,0.1,0.15)
z <- c(time=100,age=25)

## calculate intergal from 0 to 100
int.approx(z=z,time.grid=time.grid,B=B,nbasis=5,alpha=alpha)

PenCoxFrail documentation built on May 2, 2019, 6:54 a.m.