Skip to main content
added 68 characters in body
Source Link
Helix123
  • 1.5k
  • 11
  • 16

EDIT: The methods are also in CRAN versions of plm >= 1.6-4.

The appropriate methods for robust vcovs were not implemented in plm. They are now in the development version >= 1.6-1 (see http://r-forge.r-project.org/R/?group_id=406).

library(plm)
library(lmtest)
data(Cigar)
fit <- plm(price ~ sales + pop, data=Cigar, index=c("state","year"), model="within")
fit2 <- plm(price ~ sales + pop | cpi + pop, data=Cigar, index=c("state","year"), model="within")

coeftest(fit, vcov.=vcovHC(fit))

# t test of coefficients:
#
#
#         Estimate Std. Error t value  Pr(>|t|)    
# sales -1.0391141  0.1671141 -6.2180 6.726e-10 ***
# pop    0.0190151  0.0064447  2.9505  0.003228 ** 
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

coeftest(fit2, vcov.=vcovHC(fit2))

# t test of coefficients:
#
#        Estimate Std. Error t value Pr(>|t|)   
# sales -6.2479556  1.9032780 -3.2827 0.001055 **
# pop   -0.0021752  0.0121773 -0.1786 0.858260   
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

The appropriate methods for robust vcovs were not implemented in plm. They are now in the development version >= 1.6-1 (see http://r-forge.r-project.org/R/?group_id=406).

library(plm)
library(lmtest)
data(Cigar)
fit <- plm(price ~ sales + pop, data=Cigar, index=c("state","year"), model="within")
fit2 <- plm(price ~ sales + pop | cpi + pop, data=Cigar, index=c("state","year"), model="within")

coeftest(fit, vcov.=vcovHC(fit))

# t test of coefficients:
#
#
#         Estimate Std. Error t value  Pr(>|t|)    
# sales -1.0391141  0.1671141 -6.2180 6.726e-10 ***
# pop    0.0190151  0.0064447  2.9505  0.003228 ** 
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

coeftest(fit2, vcov.=vcovHC(fit2))

# t test of coefficients:
#
#        Estimate Std. Error t value Pr(>|t|)   
# sales -6.2479556  1.9032780 -3.2827 0.001055 **
# pop   -0.0021752  0.0121773 -0.1786 0.858260   
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

EDIT: The methods are also in CRAN versions of plm >= 1.6-4.

The appropriate methods for robust vcovs were not implemented in plm. They are now in the development version >= 1.6-1 (see http://r-forge.r-project.org/R/?group_id=406).

library(plm)
library(lmtest)
data(Cigar)
fit <- plm(price ~ sales + pop, data=Cigar, index=c("state","year"), model="within")
fit2 <- plm(price ~ sales + pop | cpi + pop, data=Cigar, index=c("state","year"), model="within")

coeftest(fit, vcov.=vcovHC(fit))

# t test of coefficients:
#
#
#         Estimate Std. Error t value  Pr(>|t|)    
# sales -1.0391141  0.1671141 -6.2180 6.726e-10 ***
# pop    0.0190151  0.0064447  2.9505  0.003228 ** 
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

coeftest(fit2, vcov.=vcovHC(fit2))

# t test of coefficients:
#
#        Estimate Std. Error t value Pr(>|t|)   
# sales -6.2479556  1.9032780 -3.2827 0.001055 **
# pop   -0.0021752  0.0121773 -0.1786 0.858260   
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Source Link
Helix123
  • 1.5k
  • 11
  • 16

The appropriate methods for robust vcovs were not implemented in plm. They are now in the development version >= 1.6-1 (see http://r-forge.r-project.org/R/?group_id=406).

library(plm)
library(lmtest)
data(Cigar)
fit <- plm(price ~ sales + pop, data=Cigar, index=c("state","year"), model="within")
fit2 <- plm(price ~ sales + pop | cpi + pop, data=Cigar, index=c("state","year"), model="within")

coeftest(fit, vcov.=vcovHC(fit))

# t test of coefficients:
#
#
#         Estimate Std. Error t value  Pr(>|t|)    
# sales -1.0391141  0.1671141 -6.2180 6.726e-10 ***
# pop    0.0190151  0.0064447  2.9505  0.003228 ** 
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

coeftest(fit2, vcov.=vcovHC(fit2))

# t test of coefficients:
#
#        Estimate Std. Error t value Pr(>|t|)   
# sales -6.2479556  1.9032780 -3.2827 0.001055 **
# pop   -0.0021752  0.0121773 -0.1786 0.858260   
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1