lmdiag icon indicating copy to clipboard operation
lmdiag copied to clipboard

Estimation results of linearmodels

Open spring-haru opened this issue 6 years ago • 4 comments
trafficstars

Thanks for a very useful package. It would be great if lmdiag is extended so that the estimation results of linearmodels can be used as an input, e.g. IV-2SLS and Panel Data.

spring-haru avatar Jun 10 '19 02:06 spring-haru

@spring-haru: Thanks for your comment. I'd love to work on this, but I'm currently quite busy and this won't change in the next few months.

I'll keep your request in mind and will comment here, as soon as I start working on this topic.

If anyone else likes to work on this in the meanwhile, please let me know. I would be happy for any pull request :-)

dynobo avatar Jun 14 '19 16:06 dynobo

Today I did a first implementation for linearmodels. Try lmdiag 0.3.7 and take a look into the example notebook for reference.

Don't expect it to be totally solid, yet. If you find bugs, please open a new ticket, then I'll try to fix them.

439f6284a08f4329a0ca8fcbc8da7158f856cebf

dynobo avatar Jan 21 '20 22:01 dynobo

Thanks for a great update!! I tried lmdiag, and it worked in many cases for IV2SLS, IVLIML, IVGMM and IVGMMCUE in the following links of the linearmodels website Instrumental Variable Estimation: Basic Examples and Instrumental Variable Estimation: Further Examples though it generated the following error

LinAlgError: SVD did not converge in Linear Least Squares

in some cases. There were also an error like

KeyError: 25.0

in others.

I also tried lmdiag for PooledOLS , RandomEffects, BetweenOLS, PanelOLS, FirstDifferenceOLS in the following link

Panel Data Model Estimation: Examples

But, all did not work.

For your reference, I uploaded .ipynb file which contains all calculations in this link.

Hope it helps!!

spring-haru avatar Jan 23 '20 08:01 spring-haru

@spring-haru : Thanks for your tests! I try to take a look into it the next days, and your jupyter notebook will certainly help me to identify the bugs! :-)

Just a bit background FYI: linearmodels has a quite different api than statsmodels, and is sadly not compatible. Sometimes, only the names of properties vary (eg. fitted_values vs. fittedvalues) which is easy to solve, but inearmodels also doesn't provide all information needed for the plots. I had to calculate those metrics by my own, without understanding those formulas in detail, to be honest. I'll try my best to fix as many issues as possible, but don't expect lmdiag to work 100% with linearmodels, as it takes more effort than I thought...

dynobo avatar Jan 23 '20 11:01 dynobo