View source: R/Sim.Data.Counterfactuals.R
Sim.Data.Counterfactuals | R Documentation |
The function Sim.Data.Counterfactuals
simulates a dataset that contains four (continuous) 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. The user can specify the number of patients, the desired mean values for the counterfactuals (i.e., \bold{\mu}_c
), and the desired correlations between the counterfactuals (i.e., the off-diagonal values in the standardized \bold{\Sigma}_c
matrix). For details, see the papers of Alonso et al. (submitted) and Van der Elst et al. (submitted).
Sim.Data.Counterfactuals(N.Total=2000,
mu_c=c(0, 0, 0, 0), T0S0=0, T1S1=0, T0T1=0, T0S1=0,
T1S0=0, S0S1=0, Seed=sample(1:1000, size=1))
N.Total |
The total number of patients in the simulated dataset. Default |
mu_c |
A vector that specifies the desired means for the counterfactuals |
T0S0 |
A scalar that specifies the desired correlation between the counterfactuals T0 and S0 that should be used in the generation of the data. Default |
T1S1 |
A scalar that specifies the desired correlation between the counterfactuals T1 and S1 that should be used in the generation of the data. Default |
T0T1 |
A scalar that specifies the desired correlation between the counterfactuals T0 and T1 that should be used in the generation of the data. Default |
T0S1 |
A scalar that specifies the desired correlation between the counterfactuals T0 and S1 that should be used in the generation of the data. Default |
T1S0 |
A scalar that specifies the desired correlation between the counterfactuals T1 and S0 that should be used in the generation of the data. Default |
S0S1 |
A scalar that specifies the desired correlation between the counterfactuals T0 and T1 that should be used in the generation of the data. Default |
Seed |
A seed that is used to generate the dataset. Default |
The generated object Data.Counterfactuals
(of class data.frame
) is placed in the workspace.
The specified values for T0S0, T1S1, T0T1, T0S1, T1S0, and S0S1 in the function call should form a matrix that is positive definite (i.e., they should form a valid correlation matrix). When the user specifies values that form a matrix that is not positive definite, an error message is given and the object Data.Counterfactuals
is not generated. The function Pos.Def.Matrices
can be used to examine beforehand whether a 4
by 4
matrix is positive definite.
Wim Van der Elst, Ariel Alonso, & Geert Molenberghs
Alonso, A., Van der Elst, W., Molenberghs, G., Buyse, M., & Burzykowski, T. (submitted). On the relationship between the causal inference and meta-analytic paradigms for the validation of surrogate markers.
Van der Elst, W., Alonso, A., & Molenberghs, G. (submitted). An exploration of the relationship between causal inference and meta-analytic measures of surrogacy.
Sim.Data.MTS
, Sim.Data.STS
## Generate a dataset with 2000 patients, cor(S0,T0)=cor(S1,T1)=.5,
## cor(T0,T1)=cor(T0,S1)=cor(T1,S0)=cor(S0,S1)=0, with means
## 5, 9, 12, and 15 for S0, S1, T0, and T1, respectively:
Sim.Data.Counterfactuals(N=2000, T0S0=.5, T1S1=.5, T0T1=0, T0S1=0, T1S0=0, S0S1=0,
mu_c=c(5, 9, 12, 15), Seed=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.