eb_target: Estimate Energy Balancing Weights To Match a Sample To a...

View source: R/eb_wrappers.R

eb_targetR Documentation

Estimate Energy Balancing Weights To Match a Sample To a Target

Description

eb_target is a wrapper for energybalance that focuses on using it to estimate energy balancing weights for matching a sample distribution to a target distribution, i.e., for the purposes of generalizability, transportability, or estimating the average treatment effect in the treated (ATT). The energy distance between the sample distribution and the target distribution is minimized.

Usage

eb_target(sampleX, targetX, sampleW = NULL,
          targetW = NULL, std = "studentized",
          lambda = 0)

Arguments

sampleX

a matrix or data frame of covariates composing the sample distribution to be weighted. See energybalance for how this is processed.

targetX

a matrix or data frame of covariates composing the target distribution. See energybalance for how this is processed.

sampleW

optional; a vector of sampling weights for the sample. The product of the estimated weights and sampleW will be the distribution-matching weights.

targetW

optional; a vector of sampling weights for the target.

std

character; whether to standardize the covariates. If "studentized", the distance matrix used will be the Euclidean distance with each variable scaled using its standard deviation in the target distribution (weighted by targetW if supplied). If "mahalanobis", the distance matrix used will be the Mahalanobis distance computed using the covariance matrix of the target distribution (weighted by targetW if supplied). If "none", the distance matrix used will be the Euclidean distance matrix. Default is "studentized". Abbreviations allowed.

lambda

a penalty on the sum of the squared weights. lambda/nrow(sampleX)^2 times the sum of the squared weights is added to the objective function. Increasing lambda preserves the effective sample size of the weighted sample at the expense of balance.

Value

A vector of weights, one for each row of sampleX.

Author(s)

Noah Greifer

See Also

energybalance for a more flexible interface

eb_att for a more dedicated function for estimating weights for the ATT, especially with multiple control groups.


ngreifer/energybalance documentation built on July 27, 2022, 5:50 a.m.