easystats/parameters

`vcov` argument not supported for `plm` models

vincentarelbundock opened this issue · 5 comments

The vcov argument does not appear to be supported for plm() models:

library(plm)
library(sandwich)
library(parameters)
data("Grunfeld", package = "plm")

ran <- plm(value ~ capital + inv , data = Grunfeld , model = "random" , effect = "twoways")
# identical
standard_error(ran, vcov = "HC1")
#     Parameter          SE
# 1 (Intercept) 188.2594307
# 2     capital   0.1478263
# 3         inv   0.2977203

standard_error(ran)
#     Parameter          SE
# 1 (Intercept) 188.2594307
# 2     capital   0.1478263
# 3         inv   0.2977203

# expected result
sqrt(diag(vcovHC(ran, type = "HC1")))
# (Intercept)     capital         inv 
# 274.7456387   0.4275958   0.8890063

In contrast, it works as expected for lm()

ols <- lm(value ~ capital + inv, data = Grunfeld)

standard_error(ols, vcov = "HC1")
#     Parameter         SE
# 1 (Intercept) 73.7031884
# 2     capital  0.3069001
# 3         inv  0.4707691

standard_error(ols)
#     Parameter         SE
# 1 (Intercept) 64.1418956
# 2     capital  0.2094979
# 3         inv  0.2908613

sqrt(diag(vcovHC(ols, type = "HC1")))
# (Intercept)     capital         inv 
#  73.7031884   0.3069001   0.4707691

jay.sf on stack overflow noted that:

Note, that calling vcovHC on a "plm" object calls plm::vcovHC and not sandwich::vcovHC. –
jay.sf
3 hours ago

I'm currently on vacation, but I will get back to this next week. It looks like the standard_error() method needs vcoc-support added

Thanks

Please enjoy the break!!

jay.sf on stack overflow noted that:

Note, that calling vcovHC on a "plm" object calls plm::vcovHC and not sandwich::vcovHC. –
jay.sf
3 hours ago

I think this doesn't matter when sandwich provides the generic.

Thanks, you're the best!