-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
IndShockConsumerType.getShocks() samples the shocks twice #494
Comments
Hmmm. ALL methods are approximate in this context. Not sure what the
first method you refer to could be.
Does it call DiscreteApproxToLogNormal twice?
…On Sat, Feb 8, 2020 at 1:30 AM Sebastian Benthall ***@***.***> wrote:
It looks like the IndShockConsumerType.getShocks() methods samples the
exogenous shocks twice:
1. first using one method, then throwing out the result
2. then again with a different, approximate method
https://github.com/econ-ark/HARK/blob/master/HARK/ConsumptionSaving/ConsIndShockModel.py#L2094-L2119
Doing unnecessary and unused computation is bad for performance. I.e.,
this slows down the simulation and solution runtime.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#494?email_source=notifications&email_token=AAKCK74VL5DQMIHVR4NIXKDRBX4JDA5CNFSM4KRW6OEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IL6QCQA>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKCK7YHY3COYCM4LW7R4J3RBX4JDANCNFSM4KRW6OEA>
.
--
- Chris Carroll
|
I've linked to the code; I'm just reading "approximate" from the comments. |
It's not drawing shocks for everyone twice, just "newborns"-- simulated
agents who just entered the model (thus their t_age == 0).
This is an artifact of a timing issue that has always existed in HARK, and
with HA macro more generally to some extent. It's the question of "when
does the model start for an agent?" vs "when does a period begin and end?"
We would like it to be the case that the model starts for an agent at the
beginning of some period, however that's defined. Using ordinary timing
conventions, risky outcomes reveal themselves at the start of a period. In
HARK, to solve the period t problem, the agent needs to know what the
distribution of risk is at the start of period t+1, so things like
IncomeDstn have an off-by-one problem: MyType.IncomeDstn[t] actually refers
to the distribution of income shocks that occur at the beginning of period
t+1. This also means that IncomeDstn doesn't store the income shocks that
would be experienced by someone *right as they enter the model*-- this
information isn't necessary to solve the dynamic problem!
So during simulation, when the agent has t_cycle=t, he needs to grab an
income shock from IncomeDstn[t-1]. But if this agent is a newborn,
t_age=0, then t_cycle=0 also and so they want to grab an income shock from
IncomeDstn[-1]... but that refers to the income distribution that someone
in the *very last period of the cycle* would experience. That's not
relevant for a newborn! So I fudged this part and had newborns draw
"baby's first income shock" from the distribution of shocks they will
experience *after* this period. It's an approximation in the sense that
the income shock distribution for (say) an 18 year old is *probably very
close* to that of a 19 year old, and HARK hasn't recorded the income
distribution for an 18 year old, so it just goes with the 19 year old
distribution.
…On Fri, Feb 7, 2020 at 7:36 PM Sebastian Benthall ***@***.***> wrote:
I've linked to the code; I'm just reading "approximate" from the comments.
I defer to @mnwhite <https://github.com/mnwhite> on the interpretation.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#494?email_source=notifications&email_token=ADKRAFP66I3LXJ7I7EBVAFDRBX5BVA5CNFSM4KRW6OEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELFC4BI#issuecomment-583675397>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADKRAFNSSO3B4RYG43V4XJTRBX5BVANCNFSM4KRW6OEA>
.
|
Oh, I see. I misunderstood the code. My original issue is incorrect. In any case, thanks for explaining this to me. I wouldn't have figured it out without you going into it. Calculating the shocks for newborns twice, while a much more minor issue, is still less than ideal. If you don't mind, I'd like to keep this ticket open to flag this minor issue. I hope to get to it once I have a clearer idea of the simulation logic. |
It looks like the IndShockConsumerType.getShocks() methods samples the exogenous shocks for newborn agents twice:
https://github.com/econ-ark/HARK/blob/master/HARK/ConsumptionSaving/ConsIndShockModel.py#L2094-L2119
Doing unnecessary and unused computation is bad for performance. I.e., this slows down the simulation and solution runtime.
The text was updated successfully, but these errors were encountered: