
Integration Point: Dropout - Continuous or Binary Outcome, Two Arm
Gabriel Potvin
January 16, 2025
IntegrationPointDropoutContinuousOrBinaryTwoArm.Rmd
Go back to the Integration Point: Dropout - Continuous or Binary Outcome page
Input Variables
When creating a custom R script, you can optionally use specific
variables provided by East Horizon’s engine itself. These variables are
automatically available and do not need to be set by the user, except
for the UserParam
variable. Refer to the table below for
the variables that are available for this integration point, outcome,
and study objective.
Variable | Type | Description |
---|---|---|
NumSub | Integer | Number of subjects in the trial. |
ProbDrop | Numeric | Probability of dropout, assumed to be the same across the two arms.
If you need different probabilities, you can use a custom
UserParam . |
UserParam | List | Contains all user-defined parameters specified in the East Horizon
interface (refer to the Instructions
section). To access these parameters in your R code, use the syntax:
UserParam$NameOfTheVariable , replacing
NameOfTheVariable with the appropriate parameter name. |
Expected Output Variable
East Horizon expects an output of a specific type. Refer to the table below for the expected output for this integration point:
Type | Description |
---|---|
List | A named list containing CensorInd and
ErrorCode . |
Expected Members of the Output List
Members | Type | Description |
---|---|---|
CensorInd | Vector of Integer | Vector of length NumSub , containing the generated
censor indicator values for all subjects:– 0 :
Dropout– 1 : Completer. |
ErrorCode | Integer | Optional. Can be used to handle errors in your script: – 0 : No error.– Positive Integer : Nonfatal
error, the current simulation will be aborted, but the next simulation
will proceed.– Negative Integer : Fatal error, no
further simulations will be attempted. |
Minimal Template
Your R script could contain a function such as this one, with a name
of your choice. All input variables must be declared, even if they are
not used in the script. We recommend always declaring
UserParam
as a default NULL
value in the
function arguments, as this will ensure that the same function will work
regardless of whether the user has specified any custom parameters in
East Horizon.
GenCensorInd <- function( NumSub, ProbDrop, UserParam = NULL )
{
nError <- 0 # Error handling (no error)
vCensoringIndicator <- rep( 1, NumSub ) # Initializing vector to 1 (all patients are completers)
# Write the actual code here.
# Store the generated censor indicator values in a vector called vCensoringIndicator
return( list( CensorInd = as.integer( vPatientOutcome ), ErrorCode = as.integer( nError ) ) )
}
A detailed template with step-by-step explanations is available here: Dropout.BinaryAndContinuous.R