Description Usage Arguments Details Value Examples
Generate additional simulated data at user specified analysis sequences (either driven by calendar time or number of events). Create simulation level summary of analysis timing and number of events, as well as testing results and boundary crossing
1 2 |
x |
list genearted by simulation |
anaT |
A vector or matrix of calendar time for reporting, testing, and boundary crossing probability when a gsDesign object is specified. |
anaD |
A vector of number of events for reporting, testing, and boundary crossing probability when a gsDesign object is specified. |
anatype |
use specified timing ('anaT') if 'calendar'; use specified number of events ('anaD') if 'event'; use the maximum of the two if 'both' |
method |
statistical testing method to be applied to simulated data. |
stratum |
the variable name in the simulated data for the stratified analysis |
fparam |
additional parameters needed in the user defined testing functions. This has to match the parameters in the testing function. |
d |
A 'gsDesign' object. Timing/Events and the boundary will be updated upon output. |
simtest()
takes the returned list from nphsim()
and creates and analyzes the simulated data at various analysis time points
depending on user input:
anatype = 'calendar': by specified calendar time with anaT
anatype = 'event': by specified number of events with anaD
anatype = 'both': use the later analysis time points of either anaT or anaD
Different statistical testing and summarizing procedures can be specified in the method parameter.
User defined statistical procedures can be used so long as it follows certain order of parameter setup in function definition.
Similar to nphsim()
, simtest()
can also take a gsDesign object as input, same or different from the one used in nphsim.
If used, boundary crossing is checked against the boundaries in the gsDesign object at each analysis (either specified time points or events).
The boundaries are re-calculated if the number of events at an analysis is different from the design.
The function return a list with the follow components
as Input
same as d, the gsDesign input
data table object that stores the simulated data by analysis sequence
sim: simulation sequence number
analysis: analysis sequence corresponding to first interim, second interim, etc...
t: calendar time corresponding to each analysis sequence
D: number of events corresponding to each analysis sequence
treatment: "control" or "experiment"
enterT: calendar time a subject enters the study
aval: simulated time-to-event value
cnsr: censoring status. 1 = censored, 0 = event
data table object that stores the simulation level summaries
sim: simulation sequence number
analysis: analysis sequence corresponding to first interim, second interim, etc...
t: calendar time corresponding to each analysis sequence
D: number of events corresponding to each analysis sequence
NE, NC: Number of subjects for experiment/control group
DE, DC: Number of events for experiment/control group
pval: p-Value from testing if method
parameter is specified
pvupper, pvlower: upper/lower bound nominal p-Value from the group sequential design if method
and d
parameters are specified)
xeff, xfut: upper/lower bound crossing status: 1=Yes,0=No, if method
and d
parameters are specified).
xeff and xfut take into account the previous boundary crossing status for each simulation.
E.g. if upper boundary was acrossed in a previous analysis, all subsequent xeff will be set to 1.
Similarly if lower boundary was acrossed in a previous analysis, all subsequent xeff will be set to 0.
addtional values returned by the testing functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # Use a gsSurv object as both input for simulation and testing.
# A logrank p-value and HR from cox model is reported.
library(gsDesign)
gs <- gsSurv (k = 3, test.type = 4, alpha = 0.025, beta = 0.05, timing = c( 0.5,0.75 ),
sfu = sfHSD , sfupar = c( -4 ), sfl = sfHSD, sflpar = c( -12 ),
lambdaC = log(2) / 6, hr = 0.65, hr0 = 1, eta = 0.01,
gamma = c( 2.5,5,7.5,10 ), R = c( 2,2,2,6 ) , S = NULL , T = 15 , minfup = 3 , ratio = 1)
sim1 <- nphsim(nsim=10,d=gs)
test1 <- simtest(x=sim1,anatype='event',method='LR', d=gs)
test1$result
plotsim(test1$result,y=c("hr"),dg=2,yt="Hazard Ratio",b=1,v=c(2,0.8))
# specify fixed analysis time
test2 <- simtest(x=sim1,anatype='calendar',anaT=c(10, 13, 16), method='LR', d=gs)
plotsim(test2$result,y=c("hr"),dg=2,yt="Hazard Ratio",b=1,v=c(2,0.8))
# specify by-simulation analysis time
anaT<-matrix(c(9,11,15,10,12,16),byrow=TRUE,nrow=00,ncol=3)
test3 <- simtest(x=sim1,anatype='calendar',anaT=anaT, method='LR', d=gs)
# specify number of events
test4 <- simtest(x=sim1,anatype='event',anaD=c(140, 200, 290), method='LR', d=gs)
# A user defined testing function. Additional information needed for the testing function
# can be included in the fparam.
# and provided in the \code{simtest() fparam} parameter.
library(survRM2)
test.usr1<-function (survival,cnsr,trt,stra=NULL,fparam=NULL) {
a<-rmst2(time=survival,status=1-cnsr,arm=(trt=='experiment'),tau=fparam)
b<-a$unadjusted.result
pval <- b[1,4]
y<-list(pval=round(pval,4), est=b[1,1], estlb=b[1,2],estub=b[1,3])
return(y)
}
test5 <- simtest(x=sim1,anatype='event',anaD=c(200, 290), method=test.usr1, fparam=9)
plotsim(test5$result,y=c("estlb","estub"),dg=2,yt="Estimate",v=c(2,0.8))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.