wkm.Stat: Weighted Kaplan-Meier Test Statistic

Description Usage Arguments Details Value Examples

View source: R/WKM.Stat.r

Description

Produce the Weighted Kaplan-Meier test statistic. Test statistic is constructed based on the paper of Pepe and Fleming (1989). Coding is based on work from a non-proportional hazards working group at Merck; original author ??

Usage

1
wkm.Stat(survival, cnsr, trt, stra = NULL, fparam = NULL)

Arguments

survival

time-to-event variable

cnsr

censoring variable: 1=censoring, 0=event

trt

treatment varaible. Accepted values are either "experiment" or "control"

stra

stratification variable. Default is NULL (currently not implemented)

fparam

parameter description. Set to NULL (currently not used)

Details

Although it is of interest that the statistic will reduce to RMST when the weight function = 1, the stability conditions proposed by Pepe and Fleming (1989) rule out a constant weight function when censoring is present. Input: dataframe 'indata' contains the following variables: Event.T -> Event time (failure/censor); Status -> 0 = Censored, 1 = Event of Interest; Z -> 0 = Control, 1 = Active

Value

Code returns the Z statistic and p-value.

pval

One-sided p-Value from weighted Kaplan-Meier test

z

test statistics

Df

degree of freedom. Currently always set to NA

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# weighted Kaplan-Meier test on the simulated data
library(survival)
medC = 6 
hr <- c(1, 0.6)
intervals <- 3 
gamma <- c(2.5, 5,  7.5,  10) ## a ramp-up enrollment
R     <- c(2  , 2,  2  ,  6 ) ## enrollment period: total of 12 months
eta <- -log(0.99) ## 1% monthly dropout rate
sim1 <- nphsim(nsim=1,lambdaC=log(2)/medC,lambdaE=log(2)/medC*hr, ssC=300,ssE=300,
               intervals=intervals,gamma=gamma, R=R,eta=eta)
test1 <- simtest(x=sim1, anaD=c(250,300), method=wkm.Stat)
test1$result[]

# direct function call (without cutoff)
wkm.Stat(surv=sim1$simd$survival, cnsr=sim1$simd$cnsr, trt=sim1$simd$treatment)

keaven/nphsim documentation built on May 24, 2020, 9:34 p.m.