get.tvcoef: helper function to get time-varying coefficients
Description
The function gives the time-varying coefficients based on a fitted coxtv or coxtp subject.
Users can specify the time points to calculate the time-varying coefficients.
Usage
get.tvcoef(fit, time)
Value
A matrix of the time-varying coefficients. The dimension is the length of time by nvars, where nvars is the number
of covariates in the fitted mode.
Each row represents the time-varying coefficients at the corresponding time.
Arguments
fit
model from coxtv or coxtp.
time
time points to calculate the time-varying coefficients. If NULL, the observed event times for fitting the model will be used.
z <- ExampleData$z
time <- ExampleData$time
event <- ExampleData$event
fit <- coxtv(event = event, z = z, time = time, degree = 2)
coef <- get.tvcoef(fit)