Description Usage Arguments Value Author(s) See Also Examples
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) α.
1 | 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 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 |
nbasis |
number of basis functions used when the B-spline design matrix B has been generated. |
alpha |
vector of B-spline coefficients. |
The B-spline design matrix is returned.
Andreas Groll groll@math.lmu.de
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.