Learn R Programming

AHR (version 1.5.0)

ahrKM: ahrKM

Description

Estimate average hazard ratios from k independent samples based on the Kaplan-Meier estimator

Usage

ahrKM(L, formula, data, null.theta = NULL, contrast = NULL,
  multi.test = FALSE, cov = TRUE, bootstrap = 0,
  left.limit = FALSE)

Arguments

L

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

formula

an object of class '"formula"' specifying the conditional survival model

data

data frame containing the variables in formula

null.theta

vector specifying the null hypothesis for the average hazard ratios (H_0: theta = null.theta)

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

if > 0 then use bootstrap to estimate covariance matrix (ignore if cov is TRUE)

left.limit

if TRUE use left-continuous interpolation of WKM estimates

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

survfit

Examples

Run this code
# NOT RUN {
T <- c(rexp(100, 1), rexp(100, 2))
C <- c(rexp(100, 1), rexp(100, 2))
Y <- pmin(T, C)
D <- T <= C
Z <- rep(c(0,1), c(100, 100)) # treatment indicator
fit <- ahrKM(2, Surv(Y, D) ~ Z, data.frame(Y=Y, D=D, Z=Z))
fit

## the same as above, but estimate covariance matrix using bootstrap
# }
# NOT RUN {
fitBS <- ahrKM(2, Surv(Y, D) ~ Z, data.frame(Y=Y, D=D, Z=Z), cov=FALSE,
                         bootstrap=1000)
# }

Run the code above in your browser using DataLab