Learn R Programming

PenCoxFrail (version 2.0.0)

int.approx: Approximation of a Cox likelihood intergral

Description

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

Usage

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

Value

The B-spline design matrix is returned.

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.

Author

Andreas Groll groll@math.lmu.de

See Also

pencoxfrail

Examples

Run this code
## 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)

Run the code above in your browser using DataLab