Model-robust standard error estimators for cross-sectional, time series, clustered, panel, and longitudinal data.
Changes in Version 2.5-0
o Enhanced vignette("sandwich-CL", package = "sandwich") by better describing the background of clustered covariances and being more precise in the mathematical notation. Documentation for the new features (see below, e.g., the formula cluster specification and the vcovBS() methods) has been added.
o In vcovCL(), vcovPL(), vcovPC(), and vcovBS(), the "cluster" argument (and potentially also "order.by") can be specified by a formula - provided that expand.model.frame(x, cluster) works for the model object x.
o The "cluster" and/or "order.by" are processed accordingly if observations were dropped in the NA processing of the model object x (provided x$na.action is available).
o New dedicated vcovBS() method for "lm" objects that (a) provides many more bootstrapping techniques applicable to linear models (e.g., residual-based or wild bootstrap), (b) computes the bootstrap coefficients more efficiently with lm.fit() or qr.coef() rather than update().
o New dedicated vcovBS() method for "glm" objects that uses "xy" bootstrap like the default method but uses glm.fit() instead of update() and hence is slightly faster.
o All vcovBS() methods (default, glm, and lm) facilitate parallel bootstrapping by changing the "applyfun" from the default lapply(). By setting "cores" parallel::parLapply (on Windows) or parallel::mclapply() (otherwise) are used.
o Default handling of missing parameter estimates in vcovBS() changed from "everything" to "pairwise.complete.obs" and allow modification of cov(..., use = ...). This is relevant if not all parameters can be re-estimated on the bootstrap samples, e.g., for dummy variables of relatively rare events.
o Fix of a bug in vcovHC.mlm (reported by James Pustejovsky). The off-diagonal values of the vcovHC were computed without preserving the sign of the underlying residuals. This issue did not affect the diagonal because the underlying cross product amounts to squaring all values - but it does matter for the off-diagonal. Also, type="const" was disabled in this scenario and vcov(...) is simply used instead of vcovHC(..., type = "const").
o Bug fix in vcovCL/meatCL for multi-way clustering (reported by Brian Tsay). If patterns of levels in one clustering variable also occured in another clustering variable, their interactions were sometimes not computed correctly.
o In vcovCL() for multi-way clustering without cluster adjustment, all cluster adjustment factors are omitted entirely. In previous versions they were scaled with (Gmin - 1)/Gmin, where Gmin is the minimal number of clusters across clustering dimensions.
o meatHC() and meatHAC() now pass their "..." argument to estfun(), just as meatCL(), meatPL(), and meatPC() do as well.
Changes in Version 2.4-0
o Various flavors of clustered sandwich estimators in vcovCL(), panel sandwich estimators in vcovPL(), and panel-corrected estimators a la Beck & Katz in vcovPC(). The new vignette("sandwich-CL", package = "sandwich") introduces all functions and illustrates their use and properties.
o The new function vcovBS() provides a basic (clustered) bootstrap covariance matrix estimate, using case-based resampling.
Changes in Version 2.3-4
o In meatHAC(), bwAndrews(), and bwNeweyWest() it is now assured that the estfun is transformed to a plain matrix. Otherwise for time series regression with irregular zoo data, the bandwidth estimation might have failed.
o In meatHC() it is now assured that the residuals are zero in observations where all regressors and all estimating functions are zero.
Changes in Version 2.3-3
o Now the default methods of vcovHC() and vcovHAC() are also correctly registered as S3 methods in the NAMESPACE.
o Corrected errors in Equation 3 of vignette("sandwich"). The equation incorrectly listed the error terms "u" instead of the observations "y" on the right-hand side (pointed out by Karl-Kuno Kunze).
Changes in Version 2.3-2
o sandwich(), vcovHC(), and vcovHAC() did not work when models were fitted with na.action = na.exclude because the estfun() then (correctly) preserved the NAs. This is now avoided and all functions handle the na.exclude case like the na.omit case. (Thanks to John Fox for spotting the problem and suggesting the solution.)
Changes in Version 2.3-1
o The estfun() methods for "survreg" and "coxph" objects incorrectly returned the unweighted estimating functions in case the objects were fitted with weights. Now the weights are properly extracted and used.
Changes in Version 2.3-0
o Updated Depends/Imports: Package "zoo" is only in Imports now.
Changes in Version 2.2-10
o Added estfun() and bread() methods for ordered response models from MASS::polr and ordinal::clm.
o Added output of examples and vignettes as .Rout.save for R CMD check.
Changes in Version 2.2-9
o Added convenience function lrvar() to compute the long-run variance of the mean of a time series: a simple wrapper for kernHAC() and NeweyWest() applied to lm(x ~ 1).
o lm/mlm/glm models with aliased parameters were not handled correctly (leading to errors in sandwich/vcovHC etc.), fixed now.
o An improved error message is issued if prewhitening in vcovHAC() cannot work due to collinearity in the estimating functions.
Changes in Version 2.2-8
o fixed a bug in bwNeweyWest() for "mlm" objects that only have an intercept.
Changes in Version 2.2-7
o HC4m and HC5 estimators, as suggested by Cribari-Neto and coauthors, have been added to vcovHC() and related functions.
Changes in Version 2.2-6
o bug fix in estfun() method for "survreg" objects
Changes in Version 2.2-5
o estfun() methods for "hurdle"/"zeroinfl" objects can now handle multiple offset vectors (if any)
Changes in Version 2.2-4
o new vcovHC() method for "mlm" objects. This simply combines the "meat" for each individual regression and combines the result.
Changes in Version 2.2-3
o new bread() method for "mlm" objects.
Changes in Version 2.2-2
o updates in estfun() methods for hurdle/zeroinfl objects.
Changes in Version 2.2-1
o documentation enhancements for new Rd parser.
Changes in Version 2.2-0
o added/enhanced bread() and estfun() methods for "rlm" and "mlogit" objects (from MASS and mlogit, respectively).
o made vcovHC() and vcovHAC() generic with previous function definitions as default methods.
o updated vignettes (in particular using the more convenient tobit() interface from the AER package).
Changes in Version 2.1-0
o added bread() and estfun() methods for "hurdle"/"zeroinfl" objects as computed by hurdle()/zeroinfl() in package "pscl".
o fixed bread() and estfun() methods for negative binomial "glm" objects: now dispersion = 1 is used.
Changes in Version 2.0-3
o bread() method for "lm" objects now calls summary.lm() explicitely (rather than the generic) so that it also works with "aov" objects.
Changes in Version 2.0-2
o Added new vcovOPG() function for computing the outer product of gradients estimator (works for maximum likelihood estfun() methods only).
o Scaled estfun() and bread() method for "glm" objects by dispersion estimate. Hence, this corresponds to maximum likelihood and not deviance methods.
Changes in Version 2.0-1
o Minor fix to bwAndrews() so that it can be easily used in models for multivariate means.
Changes in Version 2.0-0
o A paper based on the "sandwich-OOP" vignette was accepted for publication in volume 16(9) of Journal of Statistical Software at http://www.jstatsoft.org/
o A NAMESPACE was added for the package.
Changes in Version 1.9-0
o The vignette "sandwich-OOP" has been revised, extended and released as a technical report.
o Several estfun() methods and some of the meat() functions have been enhanced and made more consistent.
Changes in Version 1.1-1
o estfun() methods now use directly the model.matrix() method instead of the terms() and model.frame() methods.
Changes in Version 1.1-0
o sandwich is made object-oriented, so that various types of sandwich estimators can be computed not only for "lm" models, but also "glm", "survreg", etc. To achieve object orientation this various changes have been made: a sandwich() function is provided which needs a bread and a meat matrix. For the bread, a generic bread() function is provided, for the meat, there are meat(), meatHC() and meatHAC(). All rely on the existence of a estfun() method.
o vcovHC() and vcovHAC() have been restructured to use sandwich() together with meatHC() and meatHAC(), respectively.
o A new vignette "sandwich-OOP" has been added, explaining the new object-orientation features.
o Various methods to bread() and estfun() have been added, particularly for "survreg" and "coxph".