mvna {mvna} | R Documentation |
This function computes the multivariate Nelson-Aalen estimator of the cumulative transition hazards in multistate models, that is, for each possible transition, it computes an estimate of the cumulative hazard.
mvna(data, state.names, tra, cens.name)
data |
A data.frame of the form data.frame(id,from,to,time)
or (id,from,to,entry,exit)
|
state.names |
A vector of character giving the states names. |
tra |
A quadratic matrix of logical values describing the possible transitions within the multistate model. |
cens.name |
A character giving the code for censored
observations in the column 'to' of data . If there is no
censored observations in your data, put 'NULL'. |
This functions computes the Nelson-Aalen estimator as described in Anderson et al. (1993), along with the two variance estimators described in eq. (4.1.6) and (4.1.7) of Andersen et al. (1993) at each transition time.
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 transition times.
The list also contains:
time |
All the event times. |
nrisk |
A matrix giving the number at individual at risk in the transient states just before an event. |
nev |
An array which gives the number of transitions at each event times. |
ncens |
A matrix giving the number a censored observations at each event times. |
state.names |
The same as in the function call. |
cens.name |
The same as in the function call. |
The variance estimator (4.1.6) may overestimate the true variance, and the one defined eq. (4.1.7) may underestimate the true variance (see Klein (1991) and Andersen et al. (example IV.1.1, 1993)), especially with small sample set. Therefore, a warning will be produced for risk-sets smaller than 5. Klein (1991) recommends the use of the variance estimator of eq. (4.1.6) because he found it less biased.
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.
Klein, J.P. Small sample moments of some estimators of the variance of the Kaplan-Meier and Nelson-Aalen estimators. Scandinavian Journal of Statistics, 18:333–340, 1991.
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") # plot xyplot(na)