Skip to content

FEAT: Add AMF_LSS_VAR#476

Closed
QBatista wants to merge 9 commits intoQuantEcon:masterfrom
QBatista:amf_lss_var
Closed

FEAT: Add AMF_LSS_VAR#476
QBatista wants to merge 9 commits intoQuantEcon:masterfrom
QBatista:amf_lss_var

Conversation

@QBatista
Copy link
Member

@QBatista QBatista commented Mar 12, 2019

Adds an AMF_LSS_VAR class to support the lectures on additive and multiplicative functionals.

Class design

  • I've deconstructed construct_ss from the class in the lecture into 6 functions for two reasons: (i) to be able to test the construction of each matrix separately and (ii) to satisfy the single responsibility principle.

  • The functions additive_decomp and multiplicative_decomp were recomputing the additive and multiplicative decomposition every time they were called. I've made them attributes of the class that are computed only once (when the class is initialized).

  • I haven't added setter methods for the attributes because ensuring that new values are valid inputs and updating the related variables is delicate.

  • I agree with @oyamad that the plotting code should be separated from the class because the purpose of the class is to use the first-order VAR representation of an additive functional to build the LSS representation. Adding visualization methods would give another distinct responsibility to the class. That being said, there are different options for testing the plotting code if you want to include it in the class. One option is to write an image comparison test. Another option is to run numerical tests against the data returned by the plotting functions.

TODO

  • Add loglikelihood_path

  • Add helper function to compute first order stacked VAR representation from pth order representation

  • Add helper function to apply the Blanchard and Quah method

@pep8speaks
Copy link

pep8speaks commented Mar 12, 2019

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

Line 35:9: W605 invalid escape sequence '\h'
Line 35:25: W605 invalid escape sequence '\h'
Line 35:32: W605 invalid escape sequence '\h'
Line 35:44: W605 invalid escape sequence '\h'
Line 37:9: W605 invalid escape sequence '\h'
Line 37:23: W605 invalid escape sequence '\h'
Line 37:30: W605 invalid escape sequence '\h'

Comment last updated at 2020-04-19 07:54:49 UTC

@coveralls
Copy link

coveralls commented Mar 12, 2019

Coverage Status

Coverage increased (+0.2%) to 94.152% when pulling 8515484 on QBatista:amf_lss_var into f387a72 on QuantEcon:master.

@jstac
Copy link
Contributor

jstac commented Mar 19, 2019

Thanks @QBatista. This is looking good --- I like the class design. I'm in favor of pulling out the plotting code and embedding it in the lectures, even if this means we end up with similar plotting code in a few different lectures.

@mmcky
Copy link
Contributor

mmcky commented Apr 3, 2020

@QBatista is this still be worked on? Can we close this PR?

@QBatista
Copy link
Member Author

QBatista commented Apr 4, 2020

@mmcky Tom would like to move forward with this to (i) support his book with LPH and (ii) support some QuantEcon lectures such as https://python-advanced.quantecon.org/additive_functionals.html#Simulation that currently define an AMF_LSS_VAR directly in the lecture. I'll try to wrap up this PR for merging with basic functionalities needed to support the lectures this week.

@QBatista QBatista force-pushed the amf_lss_var branch 2 times, most recently from 91e57a9 to b2614b3 Compare April 4, 2020 06:30
@QBatista QBatista changed the title FEAT: Add AMF_LSS_VAR [WIP] FEAT: Add AMF_LSS_VAR Apr 9, 2020
@QBatista
Copy link
Member Author

QBatista commented Apr 9, 2020

@mmcky This is ready for review. It contains basic features for supporting the additive and multiplicative functionals lecture. Once the PR is merged and a new version of QuantEcon.py released, I can modify the lecture to use this class. The modifications needed to the lecture are minimal.

@jstac
Copy link
Contributor

jstac commented Apr 11, 2020

Well written and tested. I think this is niche but still valuable. Would it be OK if we ping you in the future if we get PRs on this @QBatista ? I double there will be many.

@QBatista
Copy link
Member Author

@jstac Yes, of course.

@oyamad
Copy link
Member

oyamad commented Apr 12, 2020

One minor comment on class naming:

According to PEP8:

Class names should normally use the CapWords convention.

See also #489 (comment).

@QBatista
Copy link
Member Author

@oyamad Thank you for pointing this out! I kept the original name from the class in the lecture because AMF_LSS_VAR would become AMFLSSVAR or AmfLssVar under PEP8 which I find hard to read. We could also use the name AdditiveMultiplicativeFunctional. This name is less informative than AMF_LSS_VAR but it shouldn't be an issue given that the documentation takes care of explaining the purpose of this class in detail. Please let me know if you have any other ideas.

@jstac
Copy link
Contributor

jstac commented Apr 13, 2020

+1 for following PEP8. I suspect the corresponding lectures would need to be edited though, since they use the existing class name.

@mmcky
Copy link
Contributor

mmcky commented Apr 5, 2022

Closing this PR as stale > 12 months.

@mmcky mmcky closed this Apr 5, 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.

6 participants