Reputation: 57
I have a linear regression I am running in R. I am calculating clustered standard errors. I get the output of coeftest()
but in some cases it doesn't report anything for a variable. I don't get an error. Does this mean the coefficient couldn't be calculated or does the coeftest not report variables that are insignificant? I can't seem to find the answer in any of the R documentation.
Here is the output from R:
lm1 <- lm(PeaceA ~ Soc_Edu + Pol_Constitution + mediation + gdp + enrollratio + infantmortality , data=qsi.surv)
coeftest(lm1, vcov = vcovHC(lm1, type = "HC1"))
t test of coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.05780946 0.20574444 -5.1414 4.973e-06 ***
Soc_Edu -1.00735592 0.11756507 -8.5685 3.088e-11 ***
mediation 0.65682159 0.06291926 10.4391 6.087e-14 ***
gdp 0.00041894 0.00010205 4.1052 0.000156 ***
enrollratio 0.00852143 0.00177600 4.7981 1.598e-05 ***
infantmortality 0.00455383 0.00079536 5.7255 6.566e-07 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Notice that there is nothing reported for the variable Pol_Constitution
.
Upvotes: 0
Views: 6253
Reputation: 3687
I assume you mean functions coeftest()
from package lmtest
and vcovHC()
from package sandwich
. In this combination, coefficients for linear dependend columns are silently dropped in coeftest
's output. Thus, I assume your variable/column Pol_Constitution
suffers from linear dependence.
Below is an example which demonstrates the behaviour with a linear dependend column. See how the estimated coefficient for I(2 * cyl)
is NA
in a simple summary()
and in coeftest()
but silently dropped when the latter is combind with vcovHC()
.
library(lmtest)
library(sandwich)
data(mtcars)
summary(mod <- lm(mpg ~ cyl + I(2*cyl), data = mtcars))
#> [...]
#> Coefficients: (1 not defined because of singularities)
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 37.8846 2.0738 18.27 < 2e-16 ***
#> cyl -2.8758 0.3224 -8.92 6.11e-10 ***
#> I(2 * cyl) NA NA NA NA
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> [...]
coeftest(mod)
#>
#> t test of coefficients:
#>
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 37.88458 2.07384 18.2678 < 2.2e-16 ***
#> cyl -2.87579 0.32241 -8.9197 6.113e-10 ***
#> I(2 * cyl) NA NA NA NA
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coeftest(mod, vcov. = vcovHC(mod))
#>
#> t test of coefficients:
#>
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 37.88458 2.74154 13.8187 1.519e-14 ***
#> cyl -2.87579 0.38869 -7.3987 3.040e-08 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Upvotes: 1