The function Sim.Data.STSBinBin
simulates a dataset that contains four (binary) counterfactuals (i.e., potential outcomes) and a (binary) treatment indicator. The counterfactuals T_0 and T_1 denote the true endpoints of a patient under the control and the experimental treatments, respectively, and the counterfactuals S_0 and S_1 denote the surrogate endpoints of the patient under the control and the experimental treatments, respectively.
In addition, the function provides the "observable" data based on the dataset of the counterfactuals, i.e., the S and T endpoints given the treatment that was allocated to a patient.
The user can specify the assumption regarding monotonicity that should be made to generate the data (no monotonicity, monotonicity for S alone, monotonicity for T alone, or monotonicity for both S and T).
1  Sim.Data.STSBinBin(Monotonicity=c("No"), N.Total=2000, Seed)

Monotonicity 
The assumption regarding monotonicity that should be made when the data are generated, i.e., 
N.Total 
The desired number of patients in the simulated dataset. Default 2000. 
Seed 
A seed that is used to generate the dataset. Default 
The generated objects Data.STSBinBin_Counterfactuals
(which contains the counterfactuals) and Data.STSBinBin_Obs
(which contains the observable data) of class data.frame
are placed in the workspace. Other relevant output can be accessed based on the fitted object (see Value below)
An object of class Sim.Data.STSBinBin
with components,
Data.STSBinBin.Obs 
The generated dataset that contains the "observed" surrogate endrpoint, true endpoint, and assigned treatment. 
Data.STSBinBin.Counter 
The generated dataset that contains the counterfactuals. 
Vector_Pi 
The vector of probabilities of the potential outcomes, i.e., pi_{0000}, pi_{0100}, pi_{0010}, pi_{0001}, pi_{0101}, pi_{1000}, pi_{1010}, pi_{1001}, pi_{1110}, pi_{1101}, pi_{1011}, pi_{1111}, pi_{0110}, pi_{0011}, pi_{0111}, pi_{1100}. 
Pi_Marginals 
The vector of marginal probabilities π_{1 \cdot 1 \cdot}, π_{0 \cdot 1 \cdot}, π_{1 \cdot 0 \cdot}, π_{0 \cdot 0 \cdot}, π_{\cdot 1 \cdot 1}, π_{\cdot 1 \cdot 0}, π_{\cdot 0 \cdot 1}, π_{\cdot 0 \cdot 0}. 
True.R2_H 
The true R_H^2 value. 
True.Theta_T 
The true odds ratio for T. 
True.Theta_S 
The true odds ratio for S. 
Wim Van der Elst, Ariel Alonso, & Geert Molenberghs
1 2 3  ## Generate a dataset with 2000 patients,
## assuming no monotonicity:
Sim.Data.STSBinBin(Monotonicity=c("No"), N.Total=200)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.