| ClusterMixture | R Documentation |
Generates data with covariates drawn from well-separated clusters. Treatment and the outcome both depend on the cluster through a pattern that no quadratic function of the cluster centers explains, so balancing the covariate means and covariances does not remove the confounding.
An R6 object of class DataSim
DataSim -> ClusterMixture
ClusterMixture$gen_data()Generates the data
ClusterMixture$gen_data()
ClusterMixture$gen_x()Generates the covariate data
ClusterMixture$gen_x()
ClusterMixture$gen_y()Generates the outcome data
ClusterMixture$gen_y()
ClusterMixture$gen_z()Generates the treatment indicator
ClusterMixture$gen_z()
ClusterMixture$new()Generates the the ClusterMixture R6 class
ClusterMixture$new(n = 100, p = 2, param = list(), overlap = "low", ...)
nThe number of observations
pThe dimensions of the covariates. At least 2; covariates past the second are noise.
paramThe data generating parameters fed as a list.
overlapOne of "low" or "high". See details.
...Extra arguments. Currently unused.
Each unit falls in one of nine equally likely
clusters centered on the grid
\{-2, 0, 2\}^2. Given its cluster
k, (X_1, X_2) \sim N(c_k, 0.4^2 I_2)
and the remaining covariates are N(0, 1).
Y(0) = Y(1) = \beta_1 \ell_k + \beta_2 (X_1 + X_2)/2 + \eta,
where the cluster level \ell_k is the
residual of c_{k1}^2 c_{k2}^2 after
regressing it on all quadratic functions of the
centers, scaled to unit variance. Defaults are
\beta = (2, 1) and \eta \sim N(0, 1).
The treatment indicator is
Z \sim Bernoulli(logit^{-1}(a \ell_k + 0.5 (X_1 + X_2)/2)),
where a = 1 if overlap is "low" and
a = 0.5 if overlap is "high".
An object of class DataSim.
data <- ClusterMixture$new(n = 100, p = 2, overlap = "low") data$gen_data() print(data$get_x()[1:2,])
ClusterMixture$get_design()Returns the chosen design parameters
ClusterMixture$get_design()
ClusterMixture$get_pscore()Returns the true propensity score
ClusterMixture$get_pscore()
ClusterMixture$get_cluster()Returns the cluster of each unit
ClusterMixture$get_cluster()
ClusterMixture$clone()The objects of this class are cloneable with this method.
ClusterMixture$clone(deep = FALSE)
deepWhether to make a deep clone.
## ------------------------------------------------
## Method `ClusterMixture$new()`
## ------------------------------------------------
data <- ClusterMixture$new(n = 100, p = 2, overlap = "low")
data$gen_data()
print(data$get_x()[1:2,])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.