Description Usage Arguments Details Value Examples
A wrapper function to run all candidate tests for a treatment difference on given data
1 2 3 | nphAlltest(survival, cnsr, trt, cutpt = median(survival),
KMtitle = "Kaplan-Meier Plot",
cumhaztitle = "Cumulative Hazard Plot")
|
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 |
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.
The function returns a list with the following components
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
Piecewise Cox model estimate, SE and 95 percent confidence limits for hazard ratio by intervals specified in cutpt
Kaplan-Meier plot
Cumulative hazard plot
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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.