Given a model and a term of interest, calculate the Aronow and Samii (2015) doi:10.1111/ajps.12185 regression weights and return an object which can be used to diagnose these implicit weights.
calculate_weights(mod, term)
The linear model object from lm
or lm_robust
.
String indicating the term for which
to calculate the implicit regression weights. This must uniquely match
a coefficient name (i.e. it must be a string which appears in only one
element of coef(mod)
).
An object of class regweight
containing:
term | The term in the regression for which weights were calculated. |
model | The partial regression model object. |
weights | The implicit regression weights. |
This calculates the implicit regression weights for a particular term in a given regression model.
In short, this calculates the weights for a coefficient \(\beta\) such that:
$$\frac{\mathrm{E}[w_i \beta_i]}{\mathrm{E}[w_i]} \to \beta$$
where \(\beta_i\) is the unit level effect. The expectation of \(w_i\) is the conditional variance of the variable of interest.
For details and examples, view the vignette:
vignette("example-usage", package = "regweight")
Aronow, P.M. and Samii, C. (2016), "Does Regression Produce Representative Estimates of Causal Effects?". American Journal of Political Science, 60: 250-267. doi:10.1111/ajps.12185