| Title: | Hierarchically Regularized Entropy Balancing |
|---|---|
| Description: | Implements hierarchically regularized entropy balancing proposed by Xu and Yang (2022) <doi:10.1017/pan.2022.12>. The method adjusts the covariate distributions of the control group to match those of the treatment group. 'hbal' automatically expands the covariate space to include higher order terms and uses cross-validation to select variable penalties for the balancing conditions. |
| Authors: | Yiqing Xu [aut, cre] (ORCID: <https://orcid.org/0000-0003-2041-6671>), Eddie Yang [aut] |
| Maintainer: | Yiqing Xu <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.3.0 |
| Built: | 2026-10-18 07:56:51 UTC |
| Source: | https://github.com/xuyiqing/hbal |
Function to load package description.
.onAttach(lib, pkg).onAttach(lib, pkg)
lib |
libname |
pkg |
package name |
No return value, called for the side effect of printing the package startup message.
Xu, Y., & Yang, E. (2022). Hierarchically Regularized Entropy Balancing. Political Analysis, 1-8. doi:10.1017/pan.2022.12
att estimates the average treatment effect on the treated (ATT) from an
hbal object returned by hbal.
att(hbalobject, method="abw", dr=TRUE, displayAll=FALSE, alpha=0.9, seed=NULL, nfolds=5, ...)att(hbalobject, method="abw", dr=TRUE, displayAll=FALSE, alpha=0.9, seed=NULL, nfolds=5, ...)
hbalobject |
an object of class |
method |
estimation method for the ATT. The default |
dr |
doubly robust, whether an outcome model is included in estimating
the ATT. With |
displayAll |
only displays treatment effect by default. If |
alpha |
tuning parameter for glmnet ( |
seed |
a single number that fixes the cross-fitting fold assignment of
|
nfolds |
number of cross-fitting folds for |
... |
arguments passed to lm_lin or lm_robust (e.g. |
The default method = "abw" (Augmented Balancing Weights;
Ben-Michael, Feller, Hirshberg and Zubizarreta 2021; Bruns-Smith, Dukes, Feller
and Ogburn 2023) combines the hbal weights with a control-group outcome model in
an augmented moment condition that is Neyman-orthogonal: its first-order
sensitivity to estimation error in either nuisance component (the outcome model,
given hbal's balance on mat; the weights, given a correct outcome model)
is zero. Let be the base weights of the treated units,
their sum, the hbal weights of the controls
(weights.co, which also sum to ), and
a ridge regression of the outcome on the columns of hbalobject$mat,
fitted on the controls only and weighted by their :
every column is standardized with the mean and
standard deviation of the controls used in the fit, the intercept is not
penalized, and the penalty is chosen once per call from
the full control sample by generalized cross-validation (GCV; Golub, Heath and
Wahba 1979) over a fixed grid of candidate values, restricted to candidates
whose effective degrees of freedom do not exceed
, with controls
and columns in mat, so that the fit can never approach an
interpolation of the controls. The selection is deterministic: no data
splitting and no random numbers are involved, and
(weighted least squares) is chosen whenever it is admissible and minimizes the
GCV score. The estimate is
where is the outcome model fitted on all controls and evaluated
at treated unit , and is the cross-fitted residual of
control : the controls are split into nfolds folds and each control's
residual uses the fit obtained without its own fold. The number of folds actually
used is ,
( and as above); means no
cross-fitting. Setting nfolds = 1 disables cross-fitting (the
correction term above becomes identically zero) and lowers root-mean-squared
error at small sample sizes in simulations accompanying this release, at the
cost of an understated standard error and, under outcome-model
misspecification, added bias; nfolds = 5 (the default) is recommended
unless a smaller root-mean-squared error is wanted more than a reliable
standard error. The standard error is influence-function based: with
,
the variance estimate is , treating
the weights and the outcome fit as fixed; p-values and the 95 percent confidence
interval use a t distribution with degrees of freedom. With
dr = FALSE the outcome model is dropped (,
) and the same formulas give the weighted difference
in means. Fold assignment is deterministic: repeated calls with the same
seed (including NULL) return identical results. If the
entropy-balancing weights of hbalobject did not converge
(hbalobject$converged is FALSE), att issues a warning for
either value of dr, because the estimate and its standard error may then
be unreliable.
method = "lm_robust" (the default before version 1.3.0) and
method = "lm_lin" are wrappers for lm_robust and lm_lin from
the estimatr package, fitted with the hbal weights; method = "elnet"
implements the approximate residual balancing estimator of Athey, Imbens and Wager
(2018) via glmnet. For method = "lm_robust", the default
se_type understates the standard error by 5 to 7 percent in the same
simulations; se_type = "HC3" corrects this for samples of 500 or fewer
but still runs about 5 percent short at 1,000.
Before version 1.3.0, dr = FALSE was accepted and silently ignored by
method = "lm_lin" and method = "elnet"; both now fall back to
"lm_robust".
A data frame with one row and seven columns (Estimate, Std. Error,
t value, Pr(>|t|), CI Lower, CI Upper, DF) when displayAll = FALSE
(the default) or method = "elnet". When displayAll = TRUE: for
method = "lm_robust" or "lm_lin", the fitted model object returned
by lm_robust or lm_lin; for method = "abw", a plain list
with elements
the ATT point estimate.
its influence-function standard error.
degrees of freedom of the t distribution used for the p-value and
the confidence interval, .
"abw".
the dr value used.
numeric vector of length : the per-unit moment
contributions (see Details), in the row order of
hbalobject; they sum to zero.
integer vector of length : the cross-fitting fold of each
control (NA for treated units, and for every unit when dr = FALSE).
the number of folds actually used (NA when dr = FALSE).
a list with coef_full (coefficients of the ridge outcome
model fitted on all controls, on the original scale of mat, named
"(Intercept)" followed by the columns of mat), coef_folds
(a list of the nfolds fold-specific coefficient vectors), and
rank_full (the rank of the full-control design including the
intercept); NULL, list() and NA respectively when
dr = FALSE.
a list with treated (the base weights of the treated
units) and control (the hbal weights of the controls), each in the row
order of hbalobject$mat within its group.
Yiqing Xu, Eddie Yang
Ben-Michael, E., Feller, A., Hirshberg, D. A., and Zubizarreta, J. R. (2021). The balancing act in causal inference. arXiv:2110.14831.
Bruns-Smith, D., Dukes, O., Feller, A., and Ogburn, E. L. (2023). Augmented balancing weights as linear regression. arXiv:2304.14545.
Golub, G. H., Heath, M., and Wahba, G. (1979). Generalized cross-validation as a method for choosing a good ridge parameter. Technometrics, 21(2), 215-223.
Athey, S., Imbens, G. W., and Wager, S. (2018). Approximate residual balancing: debiased inference of average treatment effects in high dimensions. Journal of the Royal Statistical Society: Series B, 80(4), 597-623.
Lin, W. (2013). Agnostic notes on regression adjustments to experimental data: Reexamining Freedman's critique. The Annals of Applied Statistics, 7(1), 295-318.
#EXAMPLE 1 set.seed(1984) N <- 500 X1 <- rnorm(N) X2 <- rbinom(N,size=1,prob=.5) X <- cbind(X1, X2) treat <- rbinom(N, 1, prob=0.5) # Treatment indicator y <- 0.5 * treat + X[,1] + X[,2] + rnorm(N) # Outcome dat <- data.frame(treat=treat, X, Y=y) out <- hbal(Treat = 'treat', X = c('X1', 'X2'), Y = 'Y', data=dat) sout <- summary(att(out)) # default: augmented balancing weights (abw) att(out, method = "lm_robust") # the default before version 1.3.0#EXAMPLE 1 set.seed(1984) N <- 500 X1 <- rnorm(N) X2 <- rbinom(N,size=1,prob=.5) X <- cbind(X1, X2) treat <- rbinom(N, 1, prob=0.5) # Treatment indicator y <- 0.5 * treat + X[,1] + X[,2] + rnorm(N) # Outcome dat <- data.frame(treat=treat, X, Y=y) out <- hbal(Treat = 'treat', X = c('X1', 'X2'), Y = 'Y', data=dat) sout <- summary(att(out)) # default: augmented balancing weights (abw) att(out, method = "lm_robust") # the default before version 1.3.0
hbal Object as a Data FramebalanceData returns the covariate balance statistics of an
hbal object in long form, with a column giving each term's covariate group.
This is the data plot draws for type = "balance", in a shape a
ggplot2 call can consume directly.
balanceData(hbalobject)balanceData(hbalobject)
hbalobject |
an object of class |
The returned frame has two rows per column of hbalobject$mat: one
before weighting and one after. The values come from hbalobject$bal.tab and
are therefore rounded to two decimals, exactly as summary and plot
report them. covar.group repeats each group label of
hbalobject$grouping as many times as that group has columns of mat,
in the order the groups appear.
A data frame with rows, where is the number of columns of
hbalobject$mat, and the columns
character; the column name of mat the row refers to.
factor; the covariate group of that term. The levels are the
names of hbalobject$grouping, in that order.
factor with levels "before" and "after", in that
order.
numeric; the standardized difference in means between the treated and the control group, before or after weighting.
numeric; the treated mean, the unweighted control mean and the weighted control mean of the term. Each is repeated on both of the term's rows.
Yiqing Xu, Eddie Yang
#EXAMPLE set.seed(1984) N <- 500 X1 <- rnorm(N) X2 <- rbinom(N, size = 1, prob = .5) treat <- rbinom(N, 1, prob = 0.5) Y <- 0.5 * treat + X1 + X2 + rnorm(N) dat <- data.frame(treat = treat, X1 = X1, X2 = X2, Y = Y) out <- hbal(Treat = 'treat', X = c('X1', 'X2'), Y = 'Y', data = dat) balanceData(out)#EXAMPLE set.seed(1984) N <- 500 X1 <- rnorm(N) X2 <- rbinom(N, size = 1, prob = .5) treat <- rbinom(N, 1, prob = 0.5) Y <- 0.5 * treat + X1 + X2 + rnorm(N) dat <- data.frame(treat = treat, X1 = X1, X2 = X2, Y = Y) out <- hbal(Treat = 'treat', X = c('X1', 'X2'), Y = 'Y', data = dat) balanceData(out)
Data on the contender judges from Black and Owens (2016): Courting the president: how circuit court judges alter their behavior for promotion to the Supreme Court
This dataset includes 10,171 period-judge observations for a total of 68 judges.
The treatment variable of interest is treatFinal0, which indicates whether there was a vacancy in the Supreme Court
The outcome of interest is ideological alignment of judges' votes with the sitting President (presIdeoVote).
The remaining variables are characteristics of the judges and courts, to be used as controls.
A data frame with 10171 rows and 10 columns.
ideological alignment of judges' votes with the sitting President (outcome)
treatment indicator for vacancy period
judge's Judicial Common Space (JCS)score
Ideological distribution of the sitting President
ideological composition of the panel with whom the judge sat
median JCS score of the circuit judges
JCS score of the median justice on the Supreme Court
indicator for whether the case decision was reversed by the circuit court
indicator for the publication status of thecourt's opinion
name of the judge
Black, R. C., and Owens, R. J. Replication data for: Courting the President: How Circuit Court Judges Alter Their Behavior for Promotion to the Supreme Court. Harvard Dataverse, doi:10.7910/DVN/25302. That deposit is released under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
Black, R. C., and Owens, R. J. (2016). Courting the president: how circuit court judges alter their behavior for promotion to the Supreme Court. American Journal of Political Science, 60(1), 30-43.
Internal function called by hbal to serially expand covariates.
covarExclude(colname, exclude)covarExclude(colname, exclude)
colname |
column name. |
exclude |
list of covariate name pairs or triplets to be excluded. |
Logical
Yiqing Xu, Eddie Yang
Internal function called by hbal to serially expand covariates.
covarExpand(X, exp.degree = 3, treatment = NULL, exclude = NULL)covarExpand(X, exp.degree = 3, treatment = NULL, exclude = NULL)
X |
matrix of covariates. |
exp.degree |
the degree of the polynomial. |
treatment |
treatment indicator |
exclude |
list of covariate name pairs or triplets to be excluded. |
A list with two elements: mat, the matrix of serially expanded
covariates, and grouping, an integer vector giving the number of columns
of mat in each term group (three groups when exp.degree = 2, six
when exp.degree = 3).
Yiqing Xu, Eddie Yang
Internal function called by hbal to select ridge penalties through cross-validation.
crossValidate( group.alpha = NULL, penalty.pos = NULL, penalty.val = NULL, group.exact = NULL, grouping = NULL, folds = NULL, treatment = NULL, fold.co = NULL, fold.tr = NULL, coefs = NULL, control = NULL, constraint.tolerance = NULL, print.level = NULL, base.weight = NULL, full.t = NULL, full.c = NULL, shuffle.treat = NULL )crossValidate( group.alpha = NULL, penalty.pos = NULL, penalty.val = NULL, group.exact = NULL, grouping = NULL, folds = NULL, treatment = NULL, fold.co = NULL, fold.tr = NULL, coefs = NULL, control = NULL, constraint.tolerance = NULL, print.level = NULL, base.weight = NULL, full.t = NULL, full.c = NULL, shuffle.treat = NULL )
group.alpha |
group.alpha. Controls degree of regularization. |
penalty.pos |
positions of user-supplied penalties. |
penalty.val |
values of user-supplied penalties. |
group.exact |
binary indicator of whether each covariate group should be penalized. |
grouping |
different groupings of the covariates. |
folds |
number of folds to perform cross validation. |
treatment |
covariate matrix for treatment group. |
fold.co |
fold assignments for control units. |
fold.tr |
fold assignments for treated units. |
coefs |
starting coefficients (lambda). |
control |
covariate matrix for control group. |
constraint.tolerance |
tolerance level for imbalance. |
print.level |
details of printed output. |
base.weight |
target weight distribution for the control units. |
full.t |
(unresidualized) ovariate matrix for treatment group. |
full.c |
(unresidualized) ovariate matrix for control group. |
shuffle.treat |
whether to create folds for the treated units |
A single numeric value: the mean cross-validation loss at the supplied
penalties, or Inf when that mean is not finite. hbal minimizes it
over the penalties with nloptr.
Yiqing Xu, Eddie Yang
Internal function called by hbal to perform double selection.
doubleSelection(X, W, Y, grouping)doubleSelection(X, W, Y, grouping)
X |
covaraite matrix |
W |
treatment indicator |
Y |
outcome variable |
grouping |
groupings of covariates |
resX, penalty.list, covar.keep
Yiqing Xu, Eddie Yang
hbal performs hierarchically regularized entropy balancing
such that the covariate distributions of the control group match those of the
treatment group. hbal automatically expands the covariate space to include
higher order terms and uses cross-validation to select variable penalties for the
balancing conditions.
hbal performs hierarchically regularized entropy balancing such that the covariate distributions of the control group match those of the treatment group. hbal automatically expands the covariate space to include higher order terms and uses cross-validation to select variable penalties for the balancing conditions.
hbal(data, Treat, X, Y = NULL, w = NULL, X.expand = NULL, X.keep = NULL, expand.degree = 1, coefs = NULL, max.iterations = 200, cv = NULL, folds = 4, ds = FALSE, group.exact = NULL, group.alpha = NULL, term.alpha = NULL, constraint.tolerance = 1e-3, print.level = 0, grouping = NULL, group.labs = NULL, linear.exact = TRUE, shuffle.treat = TRUE, exclude = NULL,force = FALSE, seed = NULL)hbal(data, Treat, X, Y = NULL, w = NULL, X.expand = NULL, X.keep = NULL, expand.degree = 1, coefs = NULL, max.iterations = 200, cv = NULL, folds = 4, ds = FALSE, group.exact = NULL, group.alpha = NULL, term.alpha = NULL, constraint.tolerance = 1e-3, print.level = 0, grouping = NULL, group.labs = NULL, linear.exact = TRUE, shuffle.treat = TRUE, exclude = NULL,force = FALSE, seed = NULL)
data |
a dataframe that contains the treatment, outcome, and covariates. |
Treat |
a character string of the treatment variable. |
X |
a character vector of covariate names to balance on. |
Y |
a character string of the outcome variable. |
w |
a character string of the weighting variable for base weights |
X.expand |
a character vector of covariate names for serial expansion. |
X.keep |
a character vector of covariate names to keep regardless of whether they are selected in double selection. |
expand.degree |
degree of series expansion. 1 means no expansion. Default is 1. |
coefs |
initial coefficients for the reweighting algorithm (lambdas). |
max.iterations |
maximum number of iterations. Default is 200. |
cv |
whether to use cross-validation to select the ridge
penalties. The default, |
folds |
number of folds for cross validation. Only used when cv is |
ds |
whether to perform double selection prior to balancing. Default is |
group.exact |
binary indicator of whether each covariate group should be exact balanced. |
group.alpha |
penalty for each covariate group |
term.alpha |
a named vector of user-specified ridge penalties. The names need to be variable names. Value should be non-negative (0 means exact balancing). Only work with 'expand.degree = 1' |
constraint.tolerance |
tolerance level for overall imbalance. Default is 1e-3. |
print.level |
details of printed output. |
grouping |
different groupings of the covariates. Must be specified if expand is |
group.labs |
labels for user-supplied groups |
linear.exact |
seek exact balance on the level terms |
shuffle.treat |
whether to use cross-validation on the treated units. Default is |
exclude |
list of covariate name pairs or triplets to be excluded. |
force |
binary indicator of whether to expand covariates when there are too many |
seed |
random seed passed to |
In the simplest set-up, the user can just pass in {Treat, X, Y}. With the
default settings hbal seeks exact balance on the covariates as supplied: there
is no series expansion (expand.degree = 1), no double selection
(ds = FALSE) and no cross-validation (cv resolves to FALSE), and
every ridge penalty is 0. Set expand.degree to 2 or 3 to serially expand X to
include higher order terms and hierarchically residualize them, ds = TRUE to
perform double selection and keep only the relevant variables, and cv = TRUE to
select penalties for the different groupings of the covariates by cross-validation.
A list object of class hbal with the elements below. Rows of data
with a missing value in the treatment, the outcome, any covariate or the
weighting variable are dropped before estimation, so every per-unit element has
one entry per retained row, in the order of data.
converged |
integer, 1 if the entropy-balancing algorithm converged within |
weights |
numeric vector over all units: the hbal weight of each control unit and the base weight of each treated unit. |
weights.co |
numeric vector over the control units: their entropy-balancing weights, normalized to sum to the total base weight of the treated units. |
coefs |
numeric vector of the Lagrangian multipliers returned by the reweighting algorithm, one per column of |
Treatment |
numeric vector of the treatment indicator, 1 for treated and 0 for control. |
mat |
numeric matrix of the covariates actually balanced on, on their original scale, after series expansion ( |
grouping |
named numeric vector giving the number of columns of |
group.penalty |
named numeric vector with one ridge penalty per covariate group: chosen by cross-validation when |
term.penalty |
named numeric vector with one ridge penalty per column of |
bal.tab |
numeric matrix with one row per column of |
base.weights |
numeric vector of the base weights: the variable named by |
Treat |
character string, the name of the treatment variable. |
Outcome |
numeric vector of the outcome. Present only when |
Y |
character string, the name of the outcome variable. Present only when |
call |
the matched call. |
Yiqing Xu, Eddie Yang
Yiqing Xu <[email protected]>, Eddie Yang <[email protected]>
Xu, Y., & Yang, E. (2022). Hierarchically Regularized Entropy Balancing. Political Analysis, 1-8. doi:10.1017/pan.2022.12
# Example 1 set.seed(1984) N <- 500 X1 <- rnorm(N) X2 <- rbinom(N,size=1,prob=.5) X <- cbind(X1, X2) treat <- rbinom(N, 1, prob=0.5) # Treatment indicator y <- 0.5 * treat + X[,1] + X[,2] + rnorm(N) # Outcome dat <- data.frame(treat=treat, X, Y=y) out <- hbal(Treat = 'treat', X = c('X1', 'X2'), Y = 'Y', data=dat) summary(hbal::att(out)) # Example 2 ## Simulation from Kang and Shafer (2007). if (requireNamespace("MASS", quietly = TRUE)) { set.seed(1984) n <- 500 X <- MASS::mvrnorm(n, mu = rep(0, 4), Sigma = diag(4)) prop <- 1 / (1 + exp(X[,1] - 0.5 * X[,2] + 0.25*X[,3] + 0.1 * X[,4])) # Treatment indicator treat <- rbinom(n, 1, prop) # Outcome y <- 210 + 27.4*X[,1] + 13.7*X[,2] + 13.7*X[,3] + 13.7*X[,4] + rnorm(n) # Observed covariates X.mis <- cbind(exp(X[,1]/2), X[,2]*(1+exp(X[,1]))^(-1)+10, (X[,1]*X[,3]/25+.6)^3, (X[,2]+X[,4]+20)^2) dat <- data.frame(treat=treat, X.mis, Y=y) out <- hbal(Treat = 'treat', X = c('X1', 'X2', 'X3', 'X4'), Y='Y', data=dat) summary(att(out)) }# Example 1 set.seed(1984) N <- 500 X1 <- rnorm(N) X2 <- rbinom(N,size=1,prob=.5) X <- cbind(X1, X2) treat <- rbinom(N, 1, prob=0.5) # Treatment indicator y <- 0.5 * treat + X[,1] + X[,2] + rnorm(N) # Outcome dat <- data.frame(treat=treat, X, Y=y) out <- hbal(Treat = 'treat', X = c('X1', 'X2'), Y = 'Y', data=dat) summary(hbal::att(out)) # Example 2 ## Simulation from Kang and Shafer (2007). if (requireNamespace("MASS", quietly = TRUE)) { set.seed(1984) n <- 500 X <- MASS::mvrnorm(n, mu = rep(0, 4), Sigma = diag(4)) prop <- 1 / (1 + exp(X[,1] - 0.5 * X[,2] + 0.25*X[,3] + 0.1 * X[,4])) # Treatment indicator treat <- rbinom(n, 1, prop) # Outcome y <- 210 + 27.4*X[,1] + 13.7*X[,2] + 13.7*X[,3] + 13.7*X[,4] + rnorm(n) # Observed covariates X.mis <- cbind(exp(X[,1]/2), X[,2]*(1+exp(X[,1]))^(-1)+10, (X[,1]*X[,3]/25+.6)^3, (X[,2]+X[,4]+20)^2) dat <- data.frame(treat=treat, X.mis, Y=y) out <- hbal(Treat = 'treat', X = c('X1', 'X2', 'X3', 'X4'), Y='Y', data=dat) summary(att(out)) }
The contenderJudges dataset is from Black and Owens (2016): Courting the president: how circuit court judges alter their behavior for promotion to the Supreme Court
This dataset includes 10,171 period-judge observations for a total of 68 judges.
The treatment variable of interest is treatFinal0, which indicates whether there was a vacancy in the Supreme Court
The outcome of interest is ideological alignment of judges' votes with the sitting President (presIdeoVote).
The remaining variables are characteristics of the judges and courts, to be used as controls.
The LaLonde dataset has treated units from Dehejia and Wahba (1999), containing 185 individuals; data on the control units is from Panel Study of Income Dynamics (PSID-1), containing 2,490 individuals.
data(hbal)data(hbal)
Black, R. C., and Owens, R. J. (2016). Courting the president: how circuit court judges alter their behavior for promotion to the Supreme Court. American Journal of Political Science, 60(1), 30-43.
Dehejia, R. H., and Wahba, S. (1999). Causal effects in nonexperimental studies: Reevaluating the evaluation of training programs. Journal of the American statistical Association, 94(448), 1053-1062.
Hazlett, C. (2020). KERNEL BALANCING. Statistica Sinica, 30(3), 1155-1189.
Data on the treated units is from Dehejia and Wahba (1999), containing 185 individuals; data on the control units is from Panel Study of Income Dynamics (PSID-1), containing 2,490 individuals.
A data frame with 2675 rows and 13 columns.
treatment indicator of whether an individual participated in the National Supported Work (NSW) program
years of education
demographic indicator variables for Black
idemographic indicator variables for Hispanic
demographic indicator variables for married
real earnings in 1974
real earnings in 1975
real earnings in 1978, outcome
unemployment indicator for 1974
unemployment indicator for 1975
unemployment indicator for 1978
indicator for no high school degree
National Supported Work (NSW) demonstration data from LaLonde (1986), with the treated units as re-analyzed by Dehejia and Wahba (1999) and PSID-1 controls. Taken from the replication archive of Xu and Yang (2022): Xu, Y., and Yang, E. Replication Data for: Hierarchically Regularized Entropy Balancing. Harvard Dataverse, doi:10.7910/DVN/QI2WP9. That archive is released under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
Dehejia, R. H., and Wahba, S. (1999). Causal effects in nonexperimental studies: Reevaluating the evaluation of training programs. Journal of the American statistical Association, 94(448), 1053-1062.
Hazlett, C. (2020). KERNEL BALANCING. Statistica Sinica, 30(3), 1155-1189.
hbal ObjectThis function plots the covariate difference between the control and treatment groups in standardized means before and after weighting.
## S3 method for class 'hbal' plot(x, type = 'balance', log = TRUE, base_size = 10, ...)## S3 method for class 'hbal' plot(x, type = 'balance', log = TRUE, base_size = 10, ...)
x |
an object of class |
type |
type of graph to plot. |
log |
log scale for the weight plot |
base_size |
base font size |
... |
Further arguments to be passed to |
For type = "weight", a ggplot object holding the histogram and
density of the control units' balancing weights (on the log scale when
log = TRUE); it is drawn when printed. For any other type, the
covariate-balance panels are drawn on the current graphics device and the
assembled gtable is returned invisibly.
Yiqing Xu, Eddie Yang
hbal ObjectThis function prints a summary from an hbal Object.
## S3 method for class 'hbal' summary(object, print.level = 0, ...)## S3 method for class 'hbal' summary(object, print.level = 0, ...)
object |
an object of class |
print.level |
level of details to be printed |
... |
Further arguments to be passed to |
Called for its side effect of printing a summary of the hbal object:
the call, the numbers of treated and control units, the covariate groups with
their penalties, and the balance table. The balance table
(object$bal.tab) is returned invisibly.
Yiqing Xu, Eddie Yang
Internal function called by hbal to residualize covariates.
updateCoef(old.coef, new.coef, counter)updateCoef(old.coef, new.coef, counter)
old.coef |
previous coefficients |
new.coef |
new coefficients |
counter |
which fold in CV |
updated coefficients
Yiqing Xu, Eddie Yang