Learn R Programming

AHR (version 1.5.0)

rmeanDiff: rmeanDiff

Description

Estimate difference of restricted mean survival based on (weighted) Kaplan-Meier estimates of the survival functions in each group.

Usage

rmeanDiff(L, formula, data, rr.subset = rep(TRUE, nrow(data)))

Arguments

L

time-limit specifying up to which time restricted mean will be calculated

formula

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

data

data frame containing the variables in formula

rr.subset

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

Value

An object of class '"rmd"', i.e. a list containing:

L

time limit, i.e. restricted mean up to time L is calculated

rmean1

restricted mean in group 1

rmean2

restricted mean in group 2

rmean.diff

estimated restricted mean difference

var.rmean1

an estimate of the asymptotic variance of the restricted mean in group 1

var.rmean2

an estimate of the asymptotic variance of the restricted mean in group 2

var.rmean.diff

an estimate of the asymptotic variance of the restricted mean difference

Z.rmean

the standardized test statistic for testing rmean.diff=0

p.value

p-value corresponding to Z.rmean

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))
fit <- rmeanDiff(2, formula=Surv(Y, D) ~ Z, data.frame(Y=Y, D=D, Z=Z))
# }

Run the code above in your browser using DataLab