Learn R Programming

AHR (version 1.5.0)

ahrAJ: ahrAJ

Description

Estimate average hazard ratios from k independent samples based on the Aalen-Johansen estimator of the empirical transition probabilities (NOTE: variance estimation not yet implemented)

Usage

ahrAJ(L, target, states, transitions, censoring, data, null.theta = NULL,
  contrast = NULL, multi.test = FALSE, cov = FALSE, bootstrap = 0)

Arguments

L

time-limit specifying time-interval [0,L] over which average hazard ratios will be calculated

target

string specifying the target transition, for which the Aalen-Johansen estimator is to be calculated

states

list of state names

transitions

matrix of possible transitions

censoring

name of censoring 'state'

data

data frame containing variables id, time, from, to (see etm) and Trt (factor giving treatment groups)

null.theta

vector specifying the null hypothesis for the average hazard ratios

contrast

vector of contrasts to test H_0: contrast * (theta - null.theta) = 0

multi.test

calculate multivariate test statistic if TRUE

cov

if TRUE calculate covariance matrix estimator (direct)

bootstrap

number of bootstrap samples to draw for variance estimation (default: 0 = no bootstrap, direct variance estimation). This parameter is ignored if cov=TRUE

Value

An object of class '"ahr"'

References

J.~D. Kalbfleisch and R.~L. Prentice. Estimation of the average hazard ratio. Biometrika, 68(1):105--112, Apr. 1981.

See Also

aj

Examples

Run this code
# NOT RUN {
## competing risks
Trt <- factor(rep(c(0,1), c(100, 100)))
T <- c(rexp(100, 1), rexp(100, 2))
C <- c(rexp(100, 1), rexp(100, 2))
r <- c(rbinom(100, 2, 0.5), rbinom(100, 2, 0.4))
r[(r == 0) | (T > C)] <- "cens"
data <- data.frame(id=1:200, time=pmin(T,C), from=rep(0, 200), to=r, Trt=Trt)
tra <- matrix(FALSE, nrow=3, ncol=3)
tra[1, 2:3] <- TRUE
# estimate average subdistribution hazard ratio up to L=2 for event type 1
fit <- ahrAJ(2, target="0 1", states=c("0", "1", "2"), transitions=tra, censoring="cens",
             data=data, cov=TRUE)
fit
# }

Run the code above in your browser using DataLab