Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Arellano bond panel data #421

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jaimeoliver1
Copy link

Hi,

we have implemented the Arellano Bond estimator based on this previous implementation: https://gist.github.com/toobaz/6d01be09bbd56de7038fe8ff26780138.
We have two comments:

  • The AB estimator is a panel data model, but it builds on top of an IV model. Therefore, we have thought that importing IVGMM from the linearmodels.iv.model sub-module was the easiest option, but we are open to other options.
  • We have not implemented any further tests, given that the model builds on top of already tested models. Any insight on what would the testing strategy be here?

This PR closes #95

@jaimeoliver1 jaimeoliver1 changed the title Arellano bond panel data [WIP] Arellano bond panel data Mar 23, 2022
@pep8speaks
Copy link

pep8speaks commented Mar 23, 2022

Hello @jaimeoliver1! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 3142:57: W605 invalid escape sequence '\e'
Line 3222:100: E501 line too long (122 > 99 characters)
Line 3264:100: E501 line too long (121 > 99 characters)
Line 3292:100: E501 line too long (103 > 99 characters)

Comment last updated at 2022-07-15 10:05:55 UTC

@bashtage
Copy link
Owner

Can you run black and isort?

@codecov
Copy link

codecov bot commented Mar 23, 2022

Codecov Report

Merging #421 (0e9a902) into main (21d0591) will decrease coverage by 0.47%.
The diff coverage is 18.48%.

@@            Coverage Diff             @@
##             main     #421      +/-   ##
==========================================
- Coverage   99.58%   99.11%   -0.48%     
==========================================
  Files          98       98              
  Lines       16899    20117    +3218     
  Branches     1987     2968     +981     
==========================================
+ Hits        16829    19938    +3109     
- Misses         30      142     +112     
+ Partials       40       37       -3     
Impacted Files Coverage Δ
linearmodels/panel/model.py 93.74% <18.48%> (-5.59%) ⬇️
linearmodels/__init__.py 83.33% <0.00%> (-14.23%) ⬇️
linearmodels/shared/hypotheses.py 98.55% <0.00%> (-1.45%) ⬇️
linearmodels/shared/utility.py 98.68% <0.00%> (-1.32%) ⬇️
linearmodels/panel/data.py 99.38% <0.00%> (-0.62%) ⬇️
linearmodels/panel/covariance.py 99.23% <0.00%> (-0.35%) ⬇️
linearmodels/tests/panel/test_utility.py 99.49% <0.00%> (-0.01%) ⬇️
linearmodels/iv/gmm.py 100.00% <0.00%> (ø)
linearmodels/iv/common.py 100.00% <0.00%> (ø)
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 21d0591...0e9a902. Read the comment docs.

@jaimeoliver1
Copy link
Author

@bashtage I committed the file with the correct formatting

@bashtage
Copy link
Owner

I think the best way to test would be to take the Stata code as a reference and test the various outputs and options.

@bashtage
Copy link
Owner

Overall looks very good.

  1. Need to add it to the docs.
  2. Can you break these long comments that are making PEP unhappy.
  3. Can you use a raw string r"Code with escape like \epsilon" to silence the other.

@jaimeoliver1
Copy link
Author

Hi @bashtage,

I've tried adding the stata tests, however I've no access to stata, so I would need a bit of help here.
I think the way to go would be starting by:

  1. Add the examples in the documentation here. The dataset used in the docs can be found here
  • xtabondnl(0/1).wl(0/2).(kys) yr1980-yr1984year, lags(2)
  1. Generate the model results and add them to the results_file

Once the results are in the stata-panel-simulated-results.txt, I'll be able to implement some tests here

@jaimeoliver1
Copy link
Author

Also, we fixed the linting error and silence the "\epsilon" issues.
We also added documentation in the docstring. However, doc build is failing (even in master...)

@bashtage
Copy link
Owner

Thanks for following up. I can run Stata and generate results.

@bashtage
Copy link
Owner

Going to close and reopen to trigger a rebuild.

@bashtage bashtage closed this Jul 15, 2022
@bashtage bashtage reopened this Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panel regression with lagged dependent variables
5 participants