Skip to contents

Introduction

This document provides an overview of the R examples provided in this directory. Each example is included in a directory that provides:

  • an RStudio project file,
  • a Description file that describes the example,
  • an R folder which contains the example R scripts,
  • optional: a FillInTheBlankR folder which contains the worked examples with various code deleted so you can practice and fill in the blanks.

The following examples are included:

Enrollment

Arrival Times with Poisson Process Any # of ArmsAny # of EndpointsAny Outcome This example demonstrates how to add the ability to generate patient arrival times according to a Poisson process with a ramp-up by customizing the Enrollment integration point of East Horizon.
Click here to view the full example.

Randomization

Randomization of Subjects 2-ArmMultiple ArmAny # of EndpointsAny Outcome This example illustrates four ways to customize how subjects are assigned to treatment arms in East Horizon: using a uniform distribution, using the sample() function, using the randomizeR package, and in the context of a multi-arm trial. Click here to view the full example.

Dropout

2-Arm, Patient Dropout 2-ArmSingle EndpointContinuousTTEBinaryRepeated Measures This example illustrates how to customize the dropout distribution in East Horizon for continuous and binary outcomes, time-to-event outcome, and continuous outcome with repeated measures. Click here to view the full example.
Multiple Arm, Patient Dropout Multiple ArmSingle EndpointContinuousBinary This example illustrates how to customize the dropout distribution in East Horizon for multi-arm trials, covering continuous, binary, and time-to-event outcomes. Click here to view the full example.

Response (Patient Simulation)

Continuous Outcome – Patient Simulation 2-ArmSingle EndpointContinuous This example demonstrates two ways to customize the patient outcome simulation in East Horizon for a two-arm trial with a continuous outcome: using a mixture distribution, with or without the mixture proportion sampled from a Beta distribution.
Click here to view the full example.
Time-To-Event Outcome – Patient Simulation 2-ArmSingle EndpointTTE This example demonstrates two ways to customize the patient outcome simulation in East Horizon for a two-arm trial with a time-to-event outcome: using a Weibull distribution, and using a mixture of exponential distributions. Click here to view the full example.
Binary Outcome – Patient Simulation2-ArmSingle EndpointBinary This example demonstrates two ways to customize the patient outcome simulation in East Horizon for a two-arm trial with a binary outcome: using a mixture distribution, with or without the mixture proportion sampled from a Beta distribution. Click here to view the full example.
Repeated Measures – Patient Simulation2-ArmSingle EndpointRepeated Measures This example demonstrates how to customize the patient outcome simulation in East Horizon for a two-arm trial with a continuous outcome with repeated measures using the MASS::mvrnorm() function. Click here to view the full example.
Multiple Arm – Patient SimulationMultiple ArmSingle EndpointContinuousBinary This example demonstrates how to customize the patient outcome simulation in East Horizon for multi-arm trials, covering continuous, binary, and time-to-event outcomes. Click here to view the full example.
Dual Endpoints – Patient Simulation2-ArmDual EndpointsTTE-TTE This example demonstrates how to customize the patient outcome simulation in East Horizon for two-arm trials with dual endpoints (TTE-TTE). Click here to view the full example.
Childhood Anxiety Trial 2-ArmSingle EndpointContinuous This example covers a specific situation where the patient data simulation needs to be customized to match what is expected in a clinical trial in childhood anxiety.
Click here to view the full example.

Analysis (Test Statistic)

Continuous Outcome – Analysis 2-ArmSingle EndpointContinuous This example demonstrates three ways to customize the statistical test in East Horizon for a two-arm trial with a continuous outcome: using a formula from the East manual, using the t.test() function, and using confidence interval limits for Go/No-Go decision-making. Click here to view the full example.
Time-To-Event Outcome – Analysis 2-ArmSingle EndpointTTE This example demonstrates three ways to customize the statistical test in East Horizon for a two-arm trial with a time-to-event outcome: using formulas from the East manual, using the survival::survdiff() function, and using confidence interval limits for Go/No-Go decision-making. Click here to view the full example.
Binary Outcome – Analysis 2-ArmSingle EndpointBinary This example demonstrates four ways to customize the statistical test in East Horizon for a two-arm trial with a binary outcome: using a formula from the East manual, using the prop.test() function, using confidence interval limits for Go/No-Go decision-making, and using a Bayesian Beta-Binomial model. Click here to view the full example.
Repeated Measures – Analysis2-ArmSingle EndpointRepeated Measures This example demonstrates how to customize the statistical test in East Horizon for a two-arm trial with a continuous outcome with repeated measures using the nlme::gls() function. Click here to view the full example.
Multiple Arm – AnalysisMultiple ArmSingle EndpointContinuousBinary This example demonstrates how to customize the statistical test in East Horizon for multi-arm trials, covering continuous, binary, and time-to-event outcomes. Click here to view the full example.
Dual Endpoints – Analysis2-ArmDual EndpointsTTE-TTETTE-Binary This example demonstrates how to customize the statistical test in East Horizon for two-arm trials with dual endpoints. Click here to view the full example.
Weighted Conditional Power Analysis 2-ArmSingle EndpointTTE This example demonstrates how to customize the statistical test in East Horizon for a two-arm trial with a time-to-event outcome using conditional power and futility boundaries based on the Logrank test. Click here to view the full example.

Treatment Selection

Binary Outcome - Treatment Selection Multiple ArmSingle EndpointBinary This example demonstrates four ways to customize the treatment selection in East Horizon for a multiple arm trial: based on response rates, based on p-value, based on number of responses, and based on Bayesian posterior probabilities. Click here to view the full example.

Multiplicity Adjustment

Dual Endpoints - Multiplicity Adjustment2-ArmDual EndpointsTTE-TTETTE-Binary This example demonstrates how to compute decisions for a dual-endpoint fixed sample clinical trial using the Bonferroni adjustment for multiple testing. Click here to view the full example.

Advanced Examples

These examples use more than one integration point in the same project to achieve a more complex design option.

Bayesian Assurance, Continuous 2-ArmSingle EndpointContinuous This example demonstrates the computation of Bayesian assurance, or probability of success, using a mixture of normal distribution priors featuring a two-arm trial with continuous outcome.
Click here to view the full example.
Bayesian Assurance, Time-to-Event 2-ArmSingle EndpointTTE This example demonstrates the computation of Bayesian assurance, or probability of success, using a bi-modal distribution prior featuring a two-arm trial with time-to-event outcome.
Click here to view the full example.
Consecutive Studies, Binary 2-ArmSingle EndpointBinary This example demonstrates the computation of conditional probability of success in consecutive studies. It features a sequential design involving a Phase 2 trial followed by a Phase 3 trial, both with a binary outcome Phase 2 results are saved and then used as the prior for Phase 3, allowing Phase 3 patient outcomes to be generated conditional on Phase 2 success.
Click here to view the full example.
Consecutive Studies, Continuous 2-ArmSingle EndpointContinuous This example demonstrates the computation of Bayesian assurance, or probability of success, in consecutive studies: a Phase 2 trial followed by a Phase 3 trial, both with continuous outcome. The objective is to understand how conducting a Phase 2 study can reduce the risk associated with the Phase 3 trial.
Click here to view the full example.
Consecutive Studies, Continuous & TTE 2-ArmSingle EndpointContinuousTTE This example demonstrates the computation of Bayesian assurance, or probability of success, in consecutive studies: a Phase 2 trial with continuous outcome followed by a Phase 3 trial with time-to-event outcome. The objective is to understand how conducting a Phase 2 study can reduce the risk associated with the Phase 3 trial. This example also includes a step to load the Phase 2 output and extract the true treatment differences.
Click here to view the full example.
Probability of Success, PFS & OS 2-ArmSingle EndpointTTE This example demonstrates how to compute the probability of success of a trial and extend East Horizon’s single-endpoint framework to handle dual endpoints (Progression-Free Survival and Overall Survival) using custom R scripts for the Analysis and Response integration points.
Click here to view the full example.
Multiple Endpoints w/ Covariates & Stratified Randomization 2-ArmSingle EndpointContinuous This example demonstrates how to integrate patient outcome simulation and analysis functionality for multiple independent continuous outcomes into East Horizon, across three cases: multiple endpoints using a t-test, multiple endpoints with covariates using ANCOVA, and multiple endpoints with covariates and stratified randomization. Click here to view the full example.
Schizophrenia Trial (MMRM Analysis) 2-ArmSingle EndpointRepeated Measures This example demonstrates how to simulate and analyze data using a Mixed Model for Repeated Measures (MMRM) approach in the context of a schizophrenia trial. Click here to view the full example.