test.lr: LR Test Statistic

Description Usage Arguments Details Value Examples

View source: R/test.lr.r

Description

Tests if there is a difference between two survival curves using logrank test. One sided p-value, Z statistics, HR from cox model and standard error of the HR are generated.

Usage

1
test.lr(surv, cnsr, trt, stra = NULL, fparam = NULL)

Arguments

cnsr

censoring variable: 1=censoring, 0=event

trt

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

stra

stratification variable. Default is NULL

survival

time-to-event variable

Details

test.lr is used when method='LR'

Value

The function return a list with the follow components

pval

One-sided p-Value from the logrank test

z

z statistics from the logrank test

hr

Hazard ratio from the cox proportional hazard model

sehr

Standard error of the hazard ratio

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# logrank test on the simulated data
library(survival)
medC = 6 
hr <- 0.7
intervals <- NULL 
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=300, method='LR')
test1$result[]

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

keaven/nphsim documentation built on July 2, 2018, 1:10 a.m.