Compute Bell-McCaffrey Standard Errors
BMlmSE(fit, clust_var = NULL, ell = NULL, IK = TRUE)
A model object, typically created by lm, glm, or many other model fitting functions.
A vector of length N that describes the clusters to which each cluster belongs. If `clust_var` is supplied, the function uses Bell and McCaffrey (2002)'s bias-reduced cluster-robust variance estimator. If `clust_var` is left unspecified (meaning that the user does not want clustered SEs), the function uses the HC2 robust variance estimator.
An optional vector specifying a linear combination of coefficients to compute an SE and degrees of freedom for. `ell` must have the same length as the vector of regression coefficients. For example, if `fit` is an object returned by `lm(outcome ~ treatment + covariate)`, then `ell = c(0, 1, 0)` specifies that we are only interested in the coefficient on `treatment`. If `ell` is left unspecified, the function computes SEs and degrees of freedom for all coefficients. (The adjusted degrees of freedom will generally be different for each coefficient, unlike the classical OLS degrees of freedom.)
logical (optional, FALSE by default). If `clust_var` is unspecified, `IK` has no effect on the results. If `clust_var` is supplied, `IK` determines whether the degrees of freedom are computed using the method described in Imbens and Kolesár (forthcoming) (if `IK` is `TRUE` or unspecified) or the method in Bell and McCaffrey (2002) (if `IK` is `FALSE`).
rnorm(1)#>  -1.400044