This paper introduces the R package sandwich, which provides flexible and comprehensive tools for estimating heteroskedasticity-consistent (HC) and heteroskedasticity and autocorrelation consistent (HAC) covariance matrices. These estimators are essential for valid inference in econometric models where the error structure is unknown. The package implements these estimators as reusable components that can be easily integrated into new inferential procedures. The functions in sandwich are designed to be modular and adaptable, allowing users to specify different types of HC and HAC estimators based on their needs.
The paper discusses the importance of using HC and HAC estimators in econometric analysis, particularly in the presence of heteroskedasticity and autocorrelation. It describes the implementation of these estimators in the sandwich package, highlighting their flexibility and ease of use. The package includes functions for various HC and HAC estimators, such as HC0, HC1, HC2, HC3, HC4, and different HAC estimators based on kernel functions and adaptive weighting schemes.
The paper also provides examples of how these functions can be used in practice, including testing coefficients in cross-sectional and time-series data, and detecting structural changes in the presence of heteroskedasticity and autocorrelation. The examples demonstrate the application of the sandwich package in real-world data analysis, showing how the functions can be integrated into existing statistical procedures.
The paper concludes by emphasizing the importance of using robust covariance matrix estimators in econometric research and the value of the sandwich package in providing a flexible and comprehensive set of tools for this purpose. The package is implemented in R and is available under the GPL license, making it accessible to a wide range of users in the econometric community.This paper introduces the R package sandwich, which provides flexible and comprehensive tools for estimating heteroskedasticity-consistent (HC) and heteroskedasticity and autocorrelation consistent (HAC) covariance matrices. These estimators are essential for valid inference in econometric models where the error structure is unknown. The package implements these estimators as reusable components that can be easily integrated into new inferential procedures. The functions in sandwich are designed to be modular and adaptable, allowing users to specify different types of HC and HAC estimators based on their needs.
The paper discusses the importance of using HC and HAC estimators in econometric analysis, particularly in the presence of heteroskedasticity and autocorrelation. It describes the implementation of these estimators in the sandwich package, highlighting their flexibility and ease of use. The package includes functions for various HC and HAC estimators, such as HC0, HC1, HC2, HC3, HC4, and different HAC estimators based on kernel functions and adaptive weighting schemes.
The paper also provides examples of how these functions can be used in practice, including testing coefficients in cross-sectional and time-series data, and detecting structural changes in the presence of heteroskedasticity and autocorrelation. The examples demonstrate the application of the sandwich package in real-world data analysis, showing how the functions can be integrated into existing statistical procedures.
The paper concludes by emphasizing the importance of using robust covariance matrix estimators in econometric research and the value of the sandwich package in providing a flexible and comprehensive set of tools for this purpose. The package is implemented in R and is available under the GPL license, making it accessible to a wide range of users in the econometric community.