
Compute Identifying Variation Weights
idid_weights.RdCompute regression weights describing the amount of variation used for identification.
Arguments
- reg
A regression object.
- var_interest
A vector string. The name of the variables of interest.
- partial_iv
A boolean. If TRUE, partials out the part of the endogenous variables that are not explained by the instruments. If the regression is not an IV (or not generated by
AER::ivregorfixest::feolswith an instrumented part), the value ofpartial_ivhas no impact on the outcome of the function.- tol
A numeric. Passed to the
qrfunction. The tolerance for detecting linear dependencies in the columns of x_partialled.- ...
Additional elements to pass to the regression function when partialling out controls.
Details
The weights correspond to the normalized leverage of each observation for the variables of interest after partialling out all controls.
The partailled out version of the design matrix (ie, of the set of variables
of interest) is computed by re-running the regression provided in reg
but sequentially replacing the independent variable by each of the variables
of interest (and removing them from the set of regressors).
If the nature of the independent variable and of the variable of interest
are different, one may want to change the estimation.
For instance, if the independent variable is discrete and estimated via glm
with the argument family = "binomial" and the dependent variable is
continuous, one may want to provide the argument family = "gaussian"
to idid_weights.