aj: aj

Description Usage Arguments Details Value See Also Examples

View source: R/aj.R

Description

Aalen-Johansen estimator (empirical transition matrix)

Usage

1
aj(times, data, param)

Arguments

times

a vector of evaluation times

data

data frame (see etm function documentation)

param

list of parameters (target, states, transitions, censoring, s, t, cov) (see etm documentation)

Details

Wrapper for 'etm' function from the 'etm' package to be used with ahrAJ

For a description of the parameters in the list param see the documentation of the etm function in package etm.

Value

a list containing

times

the argument times passed to the function

S

vector of 1 minus transition probabilities at times (one for each element of times)

V

vector of variances at 'times' (only if param$cov is TRUE)

logCOV

matrix containing estimated values of the log-covariance function evaluated for all pairs of elements of the vector times (only if param$cov is TRUE and model is a competing risks model)

See Also

etm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## competing risks
T <- rexp(100)
C <- rexp(100)
r <- rbinom(100, 2, 0.5)
r[(r == 0) | (T > C)] <- "cens"
data <- data.frame(id=1:100, time=pmin(T,C), from=rep(0, 100), to=r)
data <- data[order(data$time),]
tra <- matrix(FALSE, nrow=3, ncol=3)
tra[1, 2:3] <- TRUE
# estimate cumulative incidence function for event type 1
fit <- aj(sort(data$time), data, list(target="0 1", states=c("0", "1", "2"), transitions=tra,
   censoring="cens", s=0, t="last", covariance=TRUE))

mbrueckner/AHR documentation built on May 22, 2017, 12:16 a.m.