plotsim: Plot Simulated Trial Outcome Summaries

Description Usage Arguments Details Examples

View source: R/plot.sim.R

Description

Generate boxplot, display summary of number of death, timing, boundary crossing probability, and user requested simulation-level information

Usage

1
2
plotsim(d, y, dg = NULL, yt = "Y Axis Title", logs = NULL,
  b = NULL, v = c(2, 0.5))

Arguments

d

data.table "result" generated by simtest function (or a table table that has the same structure as result)

y

vector of the name(s) of the y varaible(s) for the boxplot. e.g. c("hr")

dg

number of digits for median of y below the table. NULL will disable the display of the y statistics.

yt

y-axis label

logs

TRUE=log scale for y-axis

b

whether to show boundary crossing probability at each analysis. This require xeff and xfut exist in the result data table

v

height of graph area and the summary area below.

Details

plotsim() takes the result data table from the return value of the simtest() function (or a table table that has the same structure as result) and generate the boxplot and display summary statistics.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 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=1000,d=gs)
test1 <- simtest(x=sim1,anatype='event',method='LR', d=gs)
test1$result
## Not useful, demonstration purpose only
plotsim(test1$result,y=c("hr","pval"),dg=2,yt="Hazard Ratio",b=1,v=c(2,0.8))  

keaven/nphsim documentation built on May 24, 2020, 9:34 p.m.