How can I calculate different vcov matrices after FixedEffectModels.jl?


Imagine that for some model we calculate standard errors clustered on one dimension, e.g. state:

using DataFrames, RDatasets, FixedEffectModels
df = dataset("plm", "Cigar")
df[:StateCategorical] =  categorical(df[:State])
df[:YearCategorical] =  categorical(df[:Year])
reg(df, @model(Sales ~ NDI, fe = StateCategorical + YearCategorical, weights = Pop, vcov = cluster(StateCategorical)))

Now I would like to calculate a second set of standard errors, e.g. vcov = cluster( StateCategorical + YearCategorical).
How can we calculate these without having to run the costly
reg(df, @model(Sales ~ NDI, fe = StateCategorical + YearCategorical, weights = Pop, vcov = cluster( StateCategorical + YearCategorical)))?



You can’t. The reason is that it is not clear what to do if there are observations with a missing cluster variable. You would need to reestimate the model on this new sample anyway.

Out of curiosity, is your estimation really taking a lot of time?



I understand. In my case there are no missing cluster variables. Estimation takes about 5 hours on a cluster for a single regression, but I need to run it for approximately 30 different specifications…



wow… really? Can you open an issue on Github? I did not realize some people were doing such costly computations.

1 Like