View source: R/buildtrialdesign.R
buildtrialdesign | R Documentation |
buildtrialdesign
inputs the details of a proposed clinical trial
design in an intuitive way and outputs those details in a structured form
that can be used by the pmsimstat package simulation tools
buildtrialdesign(
name_longform,
name_shortform,
timepoints,
timeptnames,
expectancies,
ondrug
)
name_longform |
A name that will clearly remind you what this trial design is. Can have spaces, etc. If not provided, will default to "Trial Design 1" |
name_shortform |
An abbreviated version of the name that can be used on plots, in your code when you want to select a certain trial design, etc. |
timepoints |
A numeric vector containing the timepoints (not including baseline) at which anything of relevance happens in your trial design. You must specify any timepoint where a measurement will be taken, the participant's expectancy about what intervention they are receiving changes, or the actual intervention itself (e.g. all randomizationpoints) can change. NOTE: The unit used is not specified - you must just ensure that the unit you use here is consistent with the unit used for e.g. the halflife of any carryover effect. Typical units would be weeks or days. |
timeptnames |
A character vector containing brief labels for each of the timepoints. If your trial has different phases, it can be helpful to incorporate those into the timepoint names for later easy reference. It is helpful if they are short enough to use as x-axis labels on a plot. If not specified, will default to "V1, V2, V3..." for Visit 1, Visit 2, etc. |
expectancies |
A numeric vector with all values ranging from 0 to 1, of the same length as timepoints. These values represent the "expectancy" a participant has at any given point that they are receiving active, effective treatment. It can match the probability that a participant is receiving active treatment (e.g. 0.5 for 1:1 randomization of active drug to placebo), but does not have to. It is used to scale the degree of the expectancy-related response factor. |
ondrug |
A list containing binary vectors that describe when participants are on active treatment or not (whether they are on a placebo or not is irrelevant for this paramater). Each vector is same length as the number of timepoints, and specificies that someone is either on active treatment at that timepoint (1) or not on active treatment at that timepoint (0). Each possible path through the trial is described by a separate vector. E.g., an open label trial will only have one path (a list with one vector, which contains all 1's), a traditional parallel group RCT would have 2 paths (all 1's and all 0's), and a trial with two randomization points would have 4 paths. |
output$metadata
contains the input variables you used for future reference,
named as above.
output$trialpaths
contains a list whose length is defined by the number
of paths through the clinical trial (ie, the length of the input variable ondrug, above),
containing the information about the trial in the form required by the pmsimstat tools.
ggplot2 for what it's using to plot
tdOL<-buildtrialdesign(
name_longform="open label",
name_shortform="OL",
timepoints=cumulative(rep(2.5,8)),
timeptname=paste("OL",1:8,sep=""),
expectancies=rep(1,8),
ondrug=list(
pathA=rep(1,8)
)
)
#Builds a 20 week entirely open-label trial
tdCO<-buildtrialdesign(
name_longform="traditional crossover",
name_shortform="CO",
timepoints=cumulative(rep(2.5,8)),
timeptname=c(paste("COa",1:4,sep=""),paste("COb",1:4,sep="")),
expectancies=rep(.5,8),
ondrug=list(
# Assumes on drug entire previous interval and this measurement point
pathA=c(1,1,1,1,0,0,0,0),
pathB=c(0,0,0,0,1,1,1,1)
)
)
# Builds a traditional crossover trial, 20 weeks long, with no washout period
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.