DataSimClass-LocalBumps: Local bumps data example

LocalBumpsR Documentation

Local bumps data example

Description

Generates data where the outcome is a checkerboard of Gaussian bumps in the first two covariates. The bandwidth sets how local the outcome is.

Value

An R6 object of class DataSim

Super class

DataSim -> LocalBumps

Methods

Public methods

Inherited methods

LocalBumps$gen_data()

Generates the data

Usage
LocalBumps$gen_data()

LocalBumps$gen_x()

Generates the covariate data

Usage
LocalBumps$gen_x()

LocalBumps$gen_y()

Generates the outcome data

Usage
LocalBumps$gen_y()

LocalBumps$gen_z()

Generates the treatment indicator

Usage
LocalBumps$gen_z()

LocalBumps$new()

Generates the the LocalBumps R6 class

Usage
LocalBumps$new(
  n = 100,
  p = 2,
  param = list(),
  bandwidth = 0.5,
  overlap = "low",
  ...
)
Arguments
n

The number of observations

p

The dimensions of the covariates. At least 2; covariates past the second are noise.

param

The data generating parameters fed as a list.

bandwidth

The standard deviation of each bump. Smaller values give a more local outcome.

overlap

One of "low" or "high". See details.

...

Extra arguments. Currently unused.

Details
Covariates

X \sim N(0, I_p).

Outcome

Y(0) = Y(1) = \beta_y f_h(X_1, X_2) + \eta, where f_h is a sum of Gaussian bumps with standard deviation h (bandwidth), centered on the grid \{-1.5, 0, 1.5\}^2 with alternating signs, and standardized to mean 0 and variance 1 under the distribution of X. The default parameters are \beta_y = 2 and \eta \sim N(0, 1).

Overlap

The treatment indicator is Z \sim Bernoulli(logit^{-1}(\beta_z (X_1 + X_2) + \beta_f f_h(X_1, X_2))), where \beta_z = 2 if overlap is "low" and \beta_z = 0.5 if overlap is "high". The default \beta_f = 1. The \beta_f term ties treatment to the bumps, so the confounding is local when h is small and smooth when h is large. With \beta_f = 0 the checkerboard averages out along X_1 + X_2 and there is almost no confounding.

Returns

An object of class DataSim.

Examples
data <- LocalBumps$new(n = 100, p = 2, bandwidth = 0.5, overlap = "low")
data$gen_data()
print(data$get_x()[1:2,])

LocalBumps$get_design()

Returns the chosen design parameters

Usage
LocalBumps$get_design()

LocalBumps$get_pscore()

Returns the true propensity score

Usage
LocalBumps$get_pscore()

LocalBumps$clone()

The objects of this class are cloneable with this method.

Usage
LocalBumps$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `LocalBumps$new()`
## ------------------------------------------------

data <- LocalBumps$new(n = 100, p = 2, bandwidth = 0.5, overlap = "low")
data$gen_data()
print(data$get_x()[1:2,])

causalOT documentation built on Nov. 24, 2026, 1:06 a.m.