Learn R Programming

mvna (version 1.0-2)

mvna: Nelson-Aalen estimator in multistate models

Description

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.

Usage

mvna(data, state.numbers, tra, cens.name, tr.choice = "all")

Arguments

data
A data.frame of the form data.frame(id,from,to,time) or (id,from,to,entry,exit) [object Object],[object Object],[object Object],[object Object],[object Object],[object Object] This data.frame is transition-oriented, i.e. it contains one
state.numbers
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 'NA'.
tr.choice
A vector of character specifying which transitions are to be computed, e.g. c("0 1","0 2") for transitions from state named '0' to state named '1', and from state '0' to state '2'. Default is "all".

Value

  • 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:

  • state.numbersThe same as in the function call.
  • cens.nameThe same as in the function call.
  • n.censNumber of censored observations

Details

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.

References

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.

See Also

xyplot.mvna,sir.adm,sir.cont

Examples

Run this code
data(sir.cont)

# Matrix of logical giving the possible transitions
tra <- matrix(ncol=3,nrow=3,TRUE)
tra[3,1:2] <- FALSE
diag(tra) <- FALSE # doesn't change much

# Computation of the Nelson-Aalen estimates
na <- mvna(sir.cont,c("0","1","2"),tra,"cens")

# plot
xyplot(na)

### See the example in the data sets help pages
### help(sir.adm) and help(sir.cont)
### for more detailed examples

Run the code above in your browser using DataLab