nphAlltest: nphAlltest A Wrapper Function

Description Usage Arguments Details Value Examples

View source: R/nphAlltest.R

Description

A wrapper function to run all candidate tests for a treatment difference on given data

Usage

1
2
nphAlltest(survival, cnsr, trt, cutpt = median(survival),
  KMtitle = "Kaplan-Meier Plot", cumhaztitle = "Cumulative Hazard Plot")

Arguments

survival

time-to-event variable

cnsr

censoring variable: 1=censoring, 0=event

trt

treatment variable

cutpt

a cutpoint or cutpoints to use in defining time intervals for piecewise hazard ratio estimation

KMtitle

title for Kaplan-Meier plot

cumhaztitle

title for cumulative hazard plot

Details

The function runs the following tests then consolidates key statistics into a summary table.
Log-Rank test/cox proportional hazard model, maximum weighted logrank (asymptotic p-value computation), restricted mean survival difference and ratio as well as restricted mean time lost ratio; note that the rmst2 default cutoff time of the minimum of the maximum observed time in each group.

Value

The function returns a list with the following components

summary.stat

concatenated summary statistics including 1-sided p-value, point estimate (mean difference/ratio for RMST tests and hazard ratios for the rest tests), lower and upper bound of 95 percent confidence interval

hr.pe

Piecewise Cox model estimate, SE and 95 percent confidence limits for hazard ratio by intervals specified in cutpt

km.plot

Kaplan-Meier plot

cumhaz.plot

Cumulative hazard plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
set.seed(1)
indf <- data.frame(trt=rep(c('control','experimental'),100),aval=rexp(200,c(0.002,0.0018)),
                   event=rbinom(200,1,0.9))
out <- nphAlltest(survival=indf$aval,cnsr=1-indf$event,trt=indf$trt)
out$summary.stat
out$km.plot
out$cumhaz.plot
x1out <- with(Ex1delayedEffect, nphAlltest(month,1-evntd,trt=factor(trt,labels=c("control","experimental"))))
x1out$summary.stat
summary(x1out$fit,times=c(3,6,9))

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