dfadjustSE: Standard Errors with adjusted degrees of freedom

View source: R/ols.R

dfadjustSER Documentation

Standard Errors with adjusted degrees of freedom

Description

Standard Errors with adjusted degrees of freedom

Usage

dfadjustSE(
  model,
  clustervar = NULL,
  ell = NULL,
  IK = TRUE,
  tol = 1e-09,
  rho0 = FALSE
)

Arguments

model

Fitted model returned by the lm function

clustervar

Factor variable that defines clusters. If NULL (or not supplied), the command computes heteroscedasticity-robust standard errors, rather than cluster-robust standard errors.

ell

A vector of the same length as the dimension of covariates, specifying which linear combination \ell'\beta of coefficients \beta to compute. If NULL, compute standard errors for each regressor coefficient.

IK

Only relevant for cluster-robust standard errors. Specifies whether to compute the degrees-of-freedom adjustment using the Imbens-Kolesár (2016) method (if TRUE), or the Bell-McCaffrey (2002) method (if FALSE).

tol

Numerical tolerance for determining whether an eigenvalue equals zero.

rho0

Impose positive \rho when estimating the Moulton (1986) model when implementing the IK method?

Value

Returns a list with the following components

vcov

Variance-covariance matrix estimator. For independent errors, it corresponds to the HC2 estimator (see MacKinnon and White, 1985, or the reference manual for the sandwich package). For clustered errors, it corresponds to a version the generalization of the HC2 estimator, called LZ2 in Imbens and Kolesár.

coefficients

Matrix of estimated coefficients, along with HC1, and HC2 standard errors, Adjusted standard errors, and effective degrees of freedom. Adjusted standard error is HC2 standard error multiplied by qt(0.975, df=dof)/qnorm(0.975) so that one can construct 95% confidence intervals by adding and subtracting 1.96 times the adjusted standard error.

rho, sig

Estimates of \rho and \sigma of the Moulton (1986) model for the regression errors. Only computed if IK method is used

References

Robert M. Bell and Daniel F. McCaffrey. Bias reduction in standard errors for linear regression with multi-stage samples. Survey Methodology, 28(2):169–181, December 2002.

Guido W. Imbens and Michal Kolesár. Robust standard errors in small samples: Some practical advice. Review of Economics and Statistics, 98(4):701–712, October 2016. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1162/REST_a_00552")}

James G. MacKinnon and Halbert White. Some Heteroskedasticity-Consistent Covariance Matrix Estimators with Improved Finite Sample Properties. Journal of Econometrics, (29)3:305–325, September 1985. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/0304-4076(85)90158-7")}

Brent R. Moulton. Random group effects and the precision of regression estimates. Journal of Econometrics, 32(3):385–397, August 1986. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/0304-4076(86)90021-7")}.

Examples

## No clustering:
set.seed(42)
x <- sin(1:100)
y <- rnorm(100)
fm <- lm(y ~ x + I(x^2))
dfadjustSE(fm)
## Clustering, with 5 clusters
clustervar <- as.factor(c(rep(1, 40), rep(1, 20),
                        rep(2, 20), rep(3, 10), rep(4, 10)))
dfadjustSE(fm, clustervar)

kolesarm/Robust-Small-Sample-Standard-Errors documentation built on Dec. 2, 2023, 10:10 p.m.