| predict.mvna {mvna} | R Documentation |
This function gives the Nelson-Aalen estimates at time-points specified by the user, along with the two variance estimators.
## S3 method for class 'mvna': predict(object, times, tr.choice, ...)
object |
An object of class 'mvna' |
times |
Time-points at which you want the estimates |
tr.choice |
A vector of character giving for which transitions you want estimates. By default, the function will give the Nelson-Aalen estimates for all the transitions. |
... |
Other arguments to predict |
Returns a list named after the possible transitions, e.g. if we define a multistate model with two possible transitions: from state 0 to state 1, and from state 0 to state 2, the returned list will have two parts named "0 1" and "0 2". Each part contains a data.frame with columns:
na |
Nelson-Aalen estimates at each transition times. |
var1 |
Variance estimator given in eq. (4.1.6) of Andersen et al. (1993). |
var2 |
Variance estimator given in eq. (4.1.7) of Andersen et al. (1993). |
time |
The given timepoints. |
Arthur Allignol, arthur.allignol@fdm.uni-freiburg.de
Andersen, P.K., Borgan, O., Gill, R.D. and Keiding, N. (1993). Statistical models based on counting processes. Springer Series in Statistics. New York, NY: Springer.
data(sir.cont)
# Modification for patients entering and leaving a state
# at the same date
sir.cont <- sir.cont[order(sir.cont$id, sir.cont$time), ]
for (i in 2:nrow(sir.cont)) {
if (sir.cont$id[i]==sir.cont$id[i-1]) {
if (sir.cont$time[i]==sir.cont$time[i-1]) {
sir.cont$time[i-1] <- sir.cont$time[i-1] - 0.5
}
}
}
# Matrix of logical giving the possible transitions
tra <- matrix(ncol=3,nrow=3,FALSE)
tra[1, 2:3] <- TRUE
tra[2, c(1, 3)] <- TRUE
# Computation of the Nelson-Aalen estimates
na <- mvna(sir.cont,c("0","1","2"),tra,"cens")
# Using predict
predict(na,times=c(1,5,10,15))