Learn R Programming

AHR (version 1.5.0)

ahrWKM: ahrWKM

Description

Estimate average hazard ratios from k independent samples based on the weighted Kaplan-Meier (WKM) estimator

Usage

ahrWKM(L, formula, data, null.theta = NULL, contrast = NULL,
  multi.test = FALSE, cov = TRUE, bootstrap = 0, alpha = 1,
  left.limit = FALSE, rr.subset = rep(TRUE, nrow(data)))

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)

alpha

exponent of the weight function

left.limit

if TRUE use left-continuous interpolation of WKM estimates instead of right-continuous interpolation

rr.subset

logical vector defining subset of observations to use for response rate estimation (default: use all observations)

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

wkm

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 <- ahrWKM(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 <- ahrWKM(2, Surv(Y, D) ~ Z, data.frame(Y=Y, D=D, Z=Z), cov=FALSE,
                         bootstrap=1000)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab