JuliaStats / GLM.jl

Generalized linear models in Julia
Other
593 stars 114 forks source link

Allow sandwich/HAC errors as in R #545

Open aolattus opened 1 year ago

aolattus commented 1 year ago

Hello there,

This is not really an issue but a repeated feature request from awhile back.

I noticed there is a very old discussion about including automatic sandwich/HAC error specification in the GLM package (proposed solutions were integrating with CovarianceMatrices.jl or something similar). However, there does not seem to have been an update to this problem since then unless I am much mistaken. I am a bit surprised that there is no way to do this with one of the main regression packages in Julia in 2023 (almost 10 years later). It's essentially standard to have this feature in statistical modeling packages (in both R and STATA it's super easy to implement).

It shouldn't be too much of an issue except that there is no way to automatically "update" the HAC corrected p-values and confidence intervals and output the result to RegressionTables.jl along with the estimated coefficients, etc. I am currently trying to find a workaround.

Thanks for your consideration, I'm a huge fan of this package.

bkamins commented 1 year ago

Fully agreed. We recently discussed with @palday to try add these features soon. In the mean time you hopefully might find this repository useful https://github.com/bkamins/WooldridgeCode.jl. It defines hvcov in https://github.com/bkamins/WooldridgeCode.jl/blob/main/init_example.jl and in the other files you have examples how to use it. (it is clearly a half-measure solution but hopefully it can be used until the issue is resolved)

aolattus commented 1 year ago

Thanks again. Looking forward to the new features!