int.approx | R Documentation |
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
.
int.approx(z,time.grid,B,nbasis,alpha)
z |
a vector which contains at the first component a time point up to which it should be integrated and the covariates |
time.grid |
an equally-spaced time grid on which the B-spline design matrix |
B |
a B-spline design matrix, which has been created with the function |
nbasis |
number of basis functions used when the B-spline design matrix |
alpha |
vector of B-spline coefficients. |
The B-spline design matrix is returned.
Andreas Groll groll@math.lmu.de
pencoxfrail
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.