Hainmueller {causalOT}R Documentation

Hainmueller data example

Description

Hainmueller data example

Hainmueller data example

Details

Generates the data as described in Hainmueller (2012).

Value

An R6 object of class DataSim

Super class

causalOT::DataSim -> Hainmueller

Methods

Public methods

Inherited methods

Method gen_data()

Generates the data

Usage
Hainmueller$gen_data()

Method gen_x()

Generates the covaraiate data

Usage
Hainmueller$gen_x()

Method gen_y()

Generates the outcome data

Usage
Hainmueller$gen_y()

Method gen_z()

Generates the treatment indicator

Usage
Hainmueller$gen_z()

Method new()

Generates the the Hainmueller R6 class

Usage
Hainmueller$new(
  n = 100,
  p = 6,
  param = list(),
  design = "A",
  overlap = "low",
  ...
)
Arguments
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.

Details
Design

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.

Overlap

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.

Returns

An object of class DataSim.

Examples
data <- Hainmueller$new(n = 100, p = 6, design = "A", overlap = "low")
data$gen_data()
print(data$get_x()[1:2,])

Method get_design()

Returns the chosen design parameters

Usage
Hainmueller$get_design()

Method get_pscore()

Returns the true propensity score

Usage
Hainmueller$get_pscore()

Method clone()

The objects of this class are cloneable with this method.

Usage
Hainmueller$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `Hainmueller$new`
## ------------------------------------------------

data <- Hainmueller$new(n = 100, p = 6, design = "A", overlap = "low")
data$gen_data()
print(data$get_x()[1:2,])

[Package causalOT version 1.0.2 Index]