Calculates weighted energy statistics used to quantify weighted dependence
weighted_energy_stats(A, X, weights, dimension_adj = TRUE)treatment vector indicating values of the treatment/exposure variable.
matrix of covariates with number of rows equal to the length of weights and each column is a
covariate
a vector of sample weights
logical scalar. Whether or not to add adjustment to energy distance terms that account for
the dimensionality of x. Defaults to TRUE.
a list with the following components
The value of the weighted dependence distance of Huling, et al. (2021) using the optimal estimated weights. This is the weighted dependence statistic without the ridge penalty on the weights.
The unweighted distance covariance term. This is the standard distance covariance of Szekely et al (2007). This term
is always equal to D_unweighted.
The weighted distance covariance term. This term itself does not directly measure weighted dependence but is a critical component of it.
The weighted energy distance between A and its weighted version
The weighted energy distance between X and its weighted version
The estimated effective sample size of the weights using Kish's effective sample size formula.
An object of class "weighted_energy_terms".
the value of the DCOW measure
the unweighted distance covariance between treatment and covariates
the weighted distance covariance between treatment and covariates
the (energy) distance between the treatment distribution and the weighted treatment distribution. Smaller values mean the marginal distribution of the treatment is preserved after weighting
the (energy) distance between the covariate distribution and the weighted covariate distribution. Smaller values mean the marginal distribution of the covariates is preserved after weighting
the expected sample size after weighting. Kish's approximation is used
Szekely, G. J., Rizzo, M. L., & Bakirov, N. K. (2007). Measuring and testing dependence by correlation of distances. Annals of Statistics 35(6) 2769-2794 10.1214/009053607000000505
Huling, J. D., Greifer, N., & Chen, G. (2021). Independence weights for causal inference with continuous exposures. arXiv preprint arXiv:2107.07086. https://arxiv.org/abs/2107.07086
# NOT RUN {
simdat <- simulate_confounded_data(seed = 999, nobs = 100)
str(simdat$data)
A <- simdat$data$A
X <- as.matrix(simdat$data[c("Z1", "Z2", "Z3", "Z4", "Z5")])
wts <- runif(length(A))
weighted_energy_stats(A, X, wts)
# }
Run the code above in your browser using DataLab