Hainmueller data example
Hainmueller data example
An R6 object of class DataSim
causalOT::DataSim
-> Hainmueller
gen_data()
Generates the data
Hainmueller$gen_data()
gen_x()
Generates the covaraiate data
Hainmueller$gen_x()
gen_y()
Generates the outcome data
Hainmueller$gen_y()
gen_z()
Generates the treatment indicator
Hainmueller$gen_z()
new()
Generates the the Hainmueller R6
class
Hainmueller$new(
n = 100,
p = 6,
param = list(),
design = "A",
overlap = "low",
...
)
n
The number of observations
p
The dimensions of the covariates. Fixed to 6.
param
The data generating parameters fed as a list.
design
One of "A" or "B". See details.
overlap
One of "high", "low", or "medium". See details.
...
Extra arguments. Currently unused.
Design "A" is the setting where the outcome is generated from a linear model, \(Y(0) = Y(1) = X_1 + X_2 + X_3 - X_4 + X_5 + X_6 + \eta\) and design "B" is where the outcome is generated from the non-linear model \(Y(0) = Y(1) = (X_1 + X_2 +X_5 )^2 + \eta\).
The treatment indicator is generated from \(Z = 1(X_1 + 2 X_2 - 2 X_3 - X_4 - 0.5 X_5 + X_6 + \nu > 0)\), where \(\nu\) depends on the overlap selected. If overlap is "high", then \(\nu \sim N(0, 100).\) If overlap is "low", then \(\nu \sim N(0, 30).\) Finally, if overlap is "medium", then \(\nu\) is drawn from a \(\chi^2\) with 5 degrees of freedom that is scaled and centered to have mean 0.5 and variance 67.6.
An object of class DataSim.
data <- Hainmueller$new(n = 100, p = 6, design = "A", overlap = "low")
data$gen_data()
print(data$get_x()[1:2,])
get_design()
Returns the chosen design parameters
Hainmueller$get_design()
get_pscore()
Returns the true propensity score
Hainmueller$get_pscore()
clone()
The objects of this class are cloneable with this method.
Hainmueller$clone(deep = FALSE)
deep
Whether to make a deep clone.
Generates the data as described in Hainmueller (2012).
## ------------------------------------------------
## Method `Hainmueller$new`
## ------------------------------------------------
data <- Hainmueller$new(n = 100, p = 6, design = "A", overlap = "low")
data$gen_data()
print(data$get_x()[1:2,])
Run the code above in your browser using DataLab