econ-ark / DemARK

Demonstrations of how to use material in the Econ-ARK
https://econ-ark.github.io/DemARK/
Apache License 2.0
33 stars 93 forks source link

Remove dependency on ConsumerParameters from DemARKs #109

Closed sbenthall closed 4 years ago

sbenthall commented 4 years ago

This breaks with HARK master

sbenthall commented 4 years ago

I'm stumped on something. In the Chinese Growth DemARK, there is the following use of ConsumerParameters:

import HARK.ConsumptionSaving.ConsumerParameters as IncomeParams

LowGrowthIncomeDstn  = constructLognormalIncomeProcessUnemployment(IncomeParams)

The entire ConsumerParameters module is being passed to this function here.

I wonder which of the parameters dictionaries would be most appropriate to use as the input to this function.

Related to https://github.com/econ-ark/HARK/issues/538

mnwhite commented 4 years ago

Well that's weird.

On Thu, Mar 19, 2020 at 1:14 PM Sebastian Benthall notifications@github.com wrote:

I'm stumped on something. In the Chinese Growth DemARK, there is the following use of ConsumerParameters:

import HARK.ConsumptionSaving.ConsumerParameters as IncomeParams

LowGrowthIncomeDstn = constructLognormalIncomeProcessUnemployment(IncomeParams)

The entire ConsumerParameters module is being passed to this function here.

I wonder which of the parameters dictionaries would be most appropriate to use as the input to this function.

Related to econ-ark/HARK#538 https://github.com/econ-ark/HARK/issues/538

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/econ-ark/DemARK/issues/109#issuecomment-601306333, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKRAFLEYA7SBR2G7PWHPWTRIJHILANCNFSM4LPK4UNA .

sbenthall commented 4 years ago

Maybe the reason why it was done this way is that if a parameters dictionary is passed in to that function, one gets this error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-3b531f79638d> in <module>
     13     'T_retire' : 0                 # Period of retirement (0 --> no retirement)
     14 }
---> 15 LowGrowthIncomeDstn  = constructLognormalIncomeProcessUnemployment(income_params)[0][0]
     16 
     17 # Remember the standard deviation of the permanent income shock in the low-growth state for later

~/projects/econ-ark/HARK/HARK/ConsumptionSaving/ConsIndShockModel.py in constructLognormalIncomeProcessUnemployment(parameters)
   2759     '''
   2760     # Unpack the parameters from the input
-> 2761     PermShkStd    = parameters.PermShkStd
   2762     PermShkCount  = parameters.PermShkCount
   2763     TranShkStd    = parameters.TranShkStd

AttributeError: 'dict' object has no attribute 'PermShkStd'
mnwhite commented 4 years ago

Yeah, the constructLognormalIncomeProcessUnemployment function is weird. The usual thing that gets passed to it is an entire IndShockConsumerType instance, which has attributes for all of the things the function is looking for. When Dave Low made this example application, he must have decided that passing the parameter file itself was a sufficient workaround. I've never noticed that he did it that way!

On Thu, Mar 19, 2020 at 4:12 PM Sebastian Benthall notifications@github.com wrote:

Maybe the reason why it was done this way is that if a parameters dictionary is passed in to that function, one gets this error:


AttributeError Traceback (most recent call last)

in 13 'T_retire' : 0 # Period of retirement (0 --> no retirement) 14 } ---> 15 LowGrowthIncomeDstn = constructLognormalIncomeProcessUnemployment(income_params)[0][0] 16 17 # Remember the standard deviation of the permanent income shock in the low-growth state for later ~/projects/econ-ark/HARK/HARK/ConsumptionSaving/ConsIndShockModel.py in constructLognormalIncomeProcessUnemployment(parameters) 2759 ''' 2760 # Unpack the parameters from the input -> 2761 PermShkStd = parameters.PermShkStd 2762 PermShkCount = parameters.PermShkCount 2763 TranShkStd = parameters.TranShkStd AttributeError: 'dict' object has no attribute 'PermShkStd' — You are receiving this because you commented. Reply to this email directly, view it on GitHub , or unsubscribe .
MridulS commented 4 years ago

fixed in https://github.com/econ-ark/DemARK/pull/110