Cluster Standard Errors with fitlm
Show older comments
I have panel data (county, year) and want to run a regression with individual-specific effects that are uncorrelated (a fixed effects regression in economics parlance). Does fitlm automatically cluster the standard errors? If not, is there a way to do this?
4 Comments
Aditya Patil
on 15 Jul 2021
Can you elaborate on what you mean by clustering of standard errors? I assume you are using fitlme, and want the errors for all the inputs to be clustered under some condition?
Joshua
on 15 Jul 2021
Aditya Patil
on 22 Sep 2021
Can you have a look at the examples provided in https://www.mathworks.com/help/stats/fitlme.html and let me know if this serves your usage? By providing random effect as (1 + x | g), you should be able to have correlation within group errors, while errors outside group will be uncorrelated.
Joshua
on 22 Sep 2021
Answers (1)
Aditya Patil
on 16 Jul 2021
1 vote
Currently, clustered standard errors is not supported in Statistics and Machine Learning Toolbox. I have brought the request to the notice of concerned developers.
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!