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

Small (easy) improvements in LaborIntMarg model #427

Closed
llorracc opened this issue Oct 31, 2019 · 6 comments
Closed

Small (easy) improvements in LaborIntMarg model #427

llorracc opened this issue Oct 31, 2019 · 6 comments

Comments

@llorracc
Copy link
Collaborator

Two (tiny, not that important) tasks left to do after #392 was merged:

(1) To adjust the xlim and ylim for the infinite horizon figures so that they're "nice" like the lifecycle ones below.

(2) To add a little 6 line method that looks at some attribute of a LaborIntMargType, reading it as nth degree polynomial coefficients, and constructs self.LbrCost using that polynomial. This is just so that time-varying LbrCost "comes from" somewhere as a constructed attribute, rather than being manually written in a parameter dictionary.

Originally posted by @mnwhite in #392 (comment)

@llorracc llorracc added good first issue Simple first issue for new contributors. Expertise: PhD-Econ Needs knowledge of economics equivalent to second year PhD student Priority: Low Status: Available submitter's first open source contribution Tag: Will Accept Item to be accepted once a PR is implemented. Type: Enhancement labels Oct 31, 2019
@mnwhite
Copy link
Contributor

mnwhite commented Oct 31, 2019

In fact, here's the code for that method, from a (private) branch:

    def updateLbrCost(self):
        '''
        Construct the age-varying cost of working LbrCost using the attribute LbrCostCoeffs.
        This attribute should be a 1D array of arbitrary length, representing polynomial
        coefficients (over t_cycle) for (log) LbrCost.
        
        Parameters
        ----------
        None
        
        Returns
        -------
        None
        '''
        Coeffs = self.LbrCostCoeffs
        N = len(Coeffs)
        age_vec = np.arange(self.T_cycle)
        LbrCostBase = np.zeros(self.T_cycle)
        for n in range(N):
            LbrCostBase += Coeffs[n]*age_vec**n
        LbrCost = np.exp(LbrCostBase)
        time_orig = self.time_flow
        self.timeFwd()
        self.LbrCost = LbrCost
        self.addToTimeVary('LbrCost')
        if not time_orig:
            self.timeRev()

So no PhD in economics required, just the ability to copy-paste that code, remove 'LbrCost' from the class definition of time_vary, and call self.updateLbrCost() in from the update() method.

@mnwhite mnwhite added Expertise: Basic Python and Open Source and removed Expertise: PhD-Econ Needs knowledge of economics equivalent to second year PhD student labels Oct 31, 2019
@llorracc
Copy link
Collaborator Author

Thx. PhD-level econ is required for understanding what you are doing and why, but not for what to do.

@rkcah
Copy link
Contributor

rkcah commented Feb 15, 2020

I will have a go at this. This is my first attempt at open source!

@mnwhite
Copy link
Contributor

mnwhite commented Feb 15, 2020 via email

@rkcah
Copy link
Contributor

rkcah commented Feb 15, 2020

I have successfully implemented the second feature.

I will send a PR then.

@MridulS
Copy link
Member

MridulS commented Jun 24, 2020

fixed in #524

@MridulS MridulS closed this as completed Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants