estimate_effect {causalOT}R Documentation

Estimate treatment effects

Description

Estimate treatment effects

Usage

estimate_effect(
  causalWeights,
  x = NULL,
  y = NULL,
  model.function,
  estimate.separately = TRUE,
  augment.estimate = FALSE,
  normalize.weights = TRUE,
  ...
)

Arguments

causalWeights

An object of class causalWeights

x

A dataHolder, matrix, data.frame, or object of class DataSim. See calc_weight for more details how to input the data. If NULL, will use the info in the causalWeights argument.

y

The outcome vector.

model.function

The modeling function to use, if desired. Must take arguments "formula", "data", and "weights". Other arguments passed via ..., the dots.

estimate.separately

Should the outcome model be estimated separately in each treatment group? TRUE or FALSE.

augment.estimate

Should an augmented, doubly robust estimator be used?

normalize.weights

Should the weights in the causalWeights argument be normalized to sum to one prior to effect estimation?

...

Pass additional arguments to the outcome modeling functions.

Value

an object of class causalEffect

Examples

if ( torch::torch_is_installed() ){
# set-up data
data <- Hainmueller$new()
data$gen_data()

# calculate quantities
weight <- calc_weight(data, method = "COT", 
                      estimand = "ATT",
                      options = list(lambda = 0))
tx_eff <- estimate_effect(causalWeights = weight)

# get estimate
print(tx_eff@estimate)
all.equal(coef(tx_eff), c(estimate = tx_eff@estimate))
}

[Package causalOT version 1.0.2 Index]