knitr::opts_chunk$set(echo = TRUE) DIR<-"C:/GitHub/bpcp/R/" source(paste0(DIR,"bpcp2sample.R")) source(paste0(DIR,"fixtdelta.R")) source(paste0(DIR,"kmciFunctions.R"))
Here is a data example. I got the data from the survival R package.
See ?survival::colon
Because we are dealing with small sample issues. Consider only those with a perforation of the colon.
library(survival) data(cancer,package="survival") # use time to death only (etype==2) d<- subset(colon,perfor==1 & rx!="Obs" & etype==2) #d<- subset(colon,obstruct==1 & rx!="Obs" & etype==2) # change time to years d$time<- d$time/365.25 s<-survfit(Surv(time,status)~rx,data=d) plot(s,lty=c(1,2),mark.time=TRUE) legend("bottomleft",levels(d$rx)[2:3],lty=1:2)
Consider the tests at different years.
bpcp2samp(d$time,d$status,d$rx,testtime=2) fixtdelta(d$time,d$status,d$rx,testtime=2) bpcp2samp(d$time,d$status,d$rx,testtime=3) fixtdelta(d$time,d$status,d$rx,testtime=3) bpcp2samp(d$time,d$status,d$rx,testtime=4) fixtdelta(d$time,d$status,d$rx,testtime=4) bpcp2samp(d$time,d$status,d$rx,testtime=5) fixtdelta(d$time,d$status,d$rx,testtime=5) bpcp2samp(d$time,d$status,d$rx,testtime=6) fixtdelta(d$time,d$status,d$rx,testtime=6) bpcp2samp(d$time,d$status,d$rx,testtime=7) fixtdelta(d$time,d$status,d$rx,testtime=7)
We could talk about how the delta method does not change between years 4 and 5 nor does it change between years 6 and 7.
It would also be nice to have some simulated data sets that look similar to the Kaplan-Meier curves, but also have a simulated scenario that looks similar to the Kaplan-Meier curves except that at year 7 the curves are equal. And hopefully when we simulate the tests at year 7, only the bpcp2samp maintains the type I error rate.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.