Skip to contents

Calculate propensity score weights

Usage

wt_ate(.propensity, ...)

# S3 method for numeric
wt_ate(
  .propensity,
  .exposure,
  .sigma = NULL,
  exposure_type = c("auto", "binary", "categorical", "continuous"),
  .treated = NULL,
  .untreated = NULL,
  stabilize = FALSE,
  stabilization_score = NULL,
  ...
)

wt_att(.propensity, ...)

# S3 method for numeric
wt_att(
  .propensity,
  .exposure,
  exposure_type = c("auto", "binary", "categorical", "continuous"),
  .treated = NULL,
  .untreated = NULL,
  ...
)

wt_atu(.propensity, ...)

# S3 method for numeric
wt_atu(
  .propensity,
  .exposure,
  exposure_type = c("auto", "binary", "categorical", "continuous"),
  .treated = NULL,
  .untreated = NULL,
  ...
)

wt_atm(.propensity, ...)

# S3 method for numeric
wt_atm(
  .propensity,
  .exposure,
  exposure_type = c("auto", "binary", "categorical", "continuous"),
  .treated = NULL,
  .untreated = NULL,
  ...
)

wt_ato(.propensity, ...)

# S3 method for numeric
wt_ato(
  .propensity,
  .exposure,
  exposure_type = c("auto", "binary", "categorical", "continuous"),
  .treated = NULL,
  .untreated = NULL,
  ...
)

Arguments

.propensity

Either a vector of the predicted value of .exposure or a data.frame where each column is the predicted probability of a level of .exposure.

...

Passed to other functions Not currently used.

.exposure

The exposure for which .propensity is calculated.

.sigma

If exposure_type is continuous, a vector of observation-level standard errors passed to dnorm(). For an lm model this is influence(model)$sigma. For data frames produced by broom's augment(), this is the .sigma column.

exposure_type

The type of exposure. By default, automatically detected based on .exposure.

.treated

The treatment level of the exposure. Automatically detected by default.

.untreated

The control level of the exposure. Automatically detected by default.

stabilize

Logical. Stabilize the weights? By default, stabilizes with the mean of .exposure.

stabilization_score

if stabilize is TRUE, optionally include a score by which to stabilize the score, e.g. the predicted values from a regression model with no predictors.

Value

A vector of propensity score weights

Examples

propensity_scores <- c(.1, .3, .4, .3)
x <- c(0, 0, 1, 0)
wt_ate(propensity_scores, .exposure = x)
#>  Treating `.exposure` as binary
#> [1] 1.111111 1.428571 2.500000 1.428571