R: No way to get double-clustered standard errors for an object of class "c('pmg', 'panelmodel')"?
Asked Answered
N

1

1

I am estimating Fama-Macbeth regression. I have taken the code from this site

fpmg <- pmg(Mumbo~Jumbo, test, index=c("year","firmid"))
summary(fpmg)     
Mean Groups model   
Call:
pmg(formula = Mumbo ~ Jumbo, data = superfdf, index = c("day","Firm")) 

Residuals
 Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
-0.142200 -0.006930  0.000000  0.000000  0.006093  0.142900
Coefficients
               Estimate  Std. Error z-value Pr(>|z|)
(Intercept) -3.0114e-03  3.7080e-03 -0.8121   0.4167
Jumbo        4.9434e-05  3.4309e-04  0.1441   0.8854
Total Sum of Squares: 1.6915
Residual Sum of Squares: 0.86425
Multiple R-squared: 0.48908`

After estimating fpmg, I estimate robust SE with double-clustering:

vcovDC <- function(x, ...){
vcovHC(x, cluster="group", ...) + vcovHC(x, cluster="time", ...) - 
    vcovHC(x, method="white1", ...)}
coeftest(fpmg, vcov=function(x) vcovHC(x, cluster="group", type="HC1"))

I get the following error:

Error in UseMethod("estfun") : 
  no applicable method for 'estfun' applied to an object of class "c('pmg', 'panelmodel')"

Please suggest how to solve this error?

Update: I have also tried "multiwayvcov" package but it shows the same error. It seems that the object class is not permitted in these packages(Sandwich, multiwayvcov etc.). It seems R essentially makes all my labour useless and I have hit the dead end. I have found how to do the above in python(I mean the code) but I have no knowledge of it.

Is there no way to solve the problem in R?


Nightcap answered 25/5, 2016 at 15:13 Comment(6)
Please provide a reproducible example, not a link to a reproducible exampleGoldfilled
This isn't a free software development service. Just because I've made a stylistic comment about your OP doesn't require me to answer your question, despite your posting increasingly demanding comments every 3-4 hours.Goldfilled
Given your error message, it would appear that estfun is a deprecated method or you are trying to apply it to the incorrect class... I am not familiar with the plm package, so cannot provide an exact answer. Cluster robust standard errors are available in R, as a simple google search will show you.Goldfilled
@Alex. Dear what do you mean by "This isn't a free software development service."? I am not asking you to develop anything! Secondly, kindly read question title properly. I already know that "Cluster robust standard errors are available in R," and I also know "you are trying to apply it to the incorrect class.". What I am asking is to get around the problem!Nightcap
@PolarBear Are there other software packages that estimate robust SEs for Fama MacBeth regressions?Intoxicative
Related: #33324828Intoxicative
S
1

this is not a problem with the code or the SW design. The point is that (AFAIK) it does not make sense to apply vcovDC - which relies on homogeneity assumptions for the coefficents - to a heterogeneous mean groups estimator. pmg already has its (nonparametric) SEs which are robust to a range of situations. See Ibragimov and Mueller, JBES 2010. This is why the classes are, in this respect, incompatible: a SW incompatibility that mirrors a theoretical one.

Sherrisherrie answered 5/6, 2016 at 11:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.