summarySandwich: Linear Model Summary with Sandwich Standard Errors

Description Usage Arguments Value Author(s) See Also Examples

View source: R/summarySandwich.R

Description

summarySandwich creates a summary of a "lm" object similar to the standard one, with sandwich estimates of the coefficient standard errors in the place of the usual OLS standard errors, also modifying as a consequence the reported t-tests and p-values for the coefficients. Standard errors may be computed from a heteroscedasticity-consistent ("HC") covariance matrix for the coefficients (of several varieties), or from a heteroscedasticity-and-autocorrelation-consistent ("HAC") covariance matrix.

Usage

1
2
3
4
5
summarySandwich(model, ...)
    
## S3 method for class 'lm'
summarySandwich(model, 
  type=c("hc3", "hc0", "hc1", "hc2", "hc4", "hac"), ...)

Arguments

model

a linear-model object.

type

type of sandwich standard errors to be computed; see hccm in the car package, and vcovHAC in the sandwich package, for details.

...

arguments to be passed to hccm or vcovHAC

Value

an object of class "summary.lm", with sandwich standard errors substituted for the usual OLS standard errors; the omnibus F-test is similarly adjusted.

Author(s)

John Fox jfox@mcmaster.ca

See Also

hccm, vcovHAC.

Examples

1
2
3
    mod <- lm(prestige ~ income + education + type, data=Prestige)
    summary(mod)
    summarySandwich(mod)

Example output

Loading required package: car
Loading required package: sandwich

Call:
lm(formula = prestige ~ income + education + type, data = Prestige)

Residuals:
     Min       1Q   Median       3Q      Max 
-14.9529  -4.4486   0.1678   5.0566  18.6320 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) -0.6229292  5.2275255  -0.119    0.905    
income       0.0010132  0.0002209   4.586 1.40e-05 ***
education    3.6731661  0.6405016   5.735 1.21e-07 ***
typeprof     6.0389707  3.8668551   1.562    0.122    
typewc      -2.7372307  2.5139324  -1.089    0.279    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 7.095 on 93 degrees of freedom
  (4 observations deleted due to missingness)
Multiple R-squared:  0.8349,	Adjusted R-squared:  0.8278 
F-statistic: 117.5 on 4 and 93 DF,  p-value: < 2.2e-16


Call:
lm(formula = prestige ~ income + education + type, data = Prestige)

Residuals:
     Min       1Q   Median       3Q      Max 
-14.9529  -4.4486   0.1678   5.0566  18.6320 

Coefficients:
              Estimate Std.Err(hc3) t value Pr(>|t|)    
(Intercept) -0.6229292    5.2381025  -0.119 0.905593    
income       0.0010132    0.0002672   3.793 0.000265 ***
education    3.6731661    0.6982758   5.260 9.16e-07 ***
typeprof     6.0389707    3.7951209   1.591 0.114948    
typewc      -2.7372307    2.4384681  -1.123 0.264531    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 7.095 on 93 degrees of freedom
  (4 observations deleted due to missingness)
Multiple R-squared:  0.8349,	Adjusted R-squared:  0.8278 
F-statistic: 120.2 on 4 and 93 DF,  p-value: < 2.2e-16

RcmdrMisc documentation built on Aug. 13, 2020, 9:06 a.m.