
Integration Point: Response - Multiple Endpoints
Gabriel Potvin
January 09, 2026
IntegrationPointResponseMulti.RmdGo back to the Integration Point: Response 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 and
endpoint.
| Variable | Type | Description |
|---|---|---|
| NumPat | Integer | Number of subjects in the trial. |
| NumArms | Integer | Number of arms in the trial ﴾including placebo/control, and experimental﴿. |
| ArrivalTime | Vector of Numeric | Vector of length NumPat, indicating the arrival time
for each subject. |
| TreatmentID | Vector of Integer | Vector of length NumPat, indicating the allocation of
subjects to arms. Index 0 represents placebo/control. For
example, [0, 0, 1] indicates three subjects: two in the
control group and one experimental. |
| EndpointType | Vector of Integer | Vector of length equal to the number of endpoints, indicating the
endpoint types: – 0: Continuous.– 1:
Binary.– 2: Time-to-Event. |
| EndpointName | Vector of Character | Vector of length equal to the number of endpoints, indicating the endpoint names. |
| RespParams | List | List containing list of parameters of length equal to the number of
endpoints: - For Endpoint = TTE, list with
SurvMethod and method-specific parameters.- For SurvMethod = 1: Hazard rate method. Use
NumPiece, StartAtTime, HR,
Control (hazard rates, can be vectors for
piecewise).- For SurvMethod = 2: Cumulative %
survival method. Use ByTime, HR,
Control (% survival at ByTime).- For SurvMethod = 3: Median survival time method. Use
HR, Control (median survival time).- For Endpoint = Binary, list with Treatment and
Control (treatment and control probabilities).- For Endpoint = Continuous, list with Treatment and
Control (treatment and control lists, first element is the
mean and second element is the standard deviation). |
| Correlation | Matrix of Integer | Correlation matrix of size equal to the number of endpoints times
the number of endpoints: – 5: Very strong positive.– 4: Strong positive.– 3: Moderate
positive.– 2: Weak positive.– 1: Very
weak positive.– 0: Uncorrelated.– -1:
Very weak negative.– -2: Weak negative.– -3: Moderate negative.– -4: Strong
negative.– -5: Very strong negative. |
| 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 one or multiple of: Response,
ArrivalRank, Corr, and
ErrorCode. |
Expected Members of the Output List
| Members | Type | Description |
|---|---|---|
| Response | Named List of Vector of Numeric | Named List of length equal to the number of endpoints, containing
the survival time or response outputs for each endpoint. For example,
Response[“Endpoint 1”] is the vector of generated response
values for each subject for Endpoint 1. The length of each vector is
NumPat. |
| 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. |
Note: Additional custom variables can be included as
members of the output list. All outputs will automatically be available
as input variables for analysis or treatment selection endpoints in the
SimData variable as described here: Variables of SimData.
Note: “Endpoint 1” is used as a sample endpoint
name. It will be the actual endpoint name as specified by the
EndpointName input.
Minimal Template
Your R script could contain a function such as this one, with a name
of your choice. All applicable 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.
A detailed template with step-by-step explanations is available here: SimulatePatientOutcome.MEP.R.
GenerateResponse <- function( NumPat, NumArms, TreatmentID, ArrivalTime, EndpointType, EndpointName, RespParams, Correlation, UserParam = NULL )
{
nError <- 0 # Error handling (no error)
lResponse <- list()
# Initialize responses
vPatientOutcomeEP1 <- rep( 0, NumPat )
vPatientOutcomeEP2 <- rep( 0, NumPat )
vPatientOutcomeEP3 <- rep( 0, NumPat )
vPatientOutcomeEP4 <- rep( 0, NumPat )
vPatientOutcomeEP5 <- rep( 0, NumPat )
# Write the actual code here.
lResponse[[EndpointName[[1]]]] <- vPatientOutcomeEP1
lResponse[[EndpointName[[2]]]] <- vPatientOutcomeEP2
lResponse[[EndpointName[[3]]]] <- vPatientOutcomeEP3
lResponse[[EndpointName[[4]]]] <- vPatientOutcomeEP4
lResponse[[EndpointName[[5]]]] <- vPatientOutcomeEP5
return( list( Response = as.list( lResponse ), ErrorCode = as.integer( nError ) ) )
}