Sim.Data.Counterfactuals: Simulate a dataset that contains counterfactuals

View source: R/Sim.Data.Counterfactuals.R

Sim.Data.CounterfactualsR Documentation

Simulate a dataset that contains counterfactuals

Description

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).

Usage

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))

Arguments

N.Total

The total number of patients in the simulated dataset. Default 2000.

mu_c

A vector that specifies the desired means for the counterfactuals S_0, S_1, T_0, and T_1, respectively. Default c(0, 0, 0, 0).

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 0.

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 0.

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 0.

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 0.

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 0.

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 0.

Seed

A seed that is used to generate the dataset. Default sample(x=1:1000, size=1), i.e., a random number between 1 and 1000.

Details

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.

Author(s)

Wim Van der Elst, Ariel Alonso, & Geert Molenberghs

References

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.

See Also

Sim.Data.MTS, Sim.Data.STS

Examples

## 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)

Surrogate documentation built on June 22, 2024, 9:16 a.m.