Skip to content

LivPrb affects agent's initial assets when they're simulated #1491

Open
@DominicWC

Description

Changing many variables for agents changes their initial assets even when they haven't died, there's no uncertainty, and the change is only for parameter events that have happened before the agent's birth.

To Reproduce
from HARK.ConsumptionSaving.ConsIndShockModel import PerfForesightConsumerType
PerfForesightDict = {
# Parameters actually used in the solution method
"CRRA": 2.0, # Coefficient of relative risk aversion
"Rfree": [1.00,1.00,1.00,1.00], # Interest factor on assets
"DiscFac": .96, # Default intertemporal discount factor
"LivPrb": [0.9,.9,.9,.9], # Survival probability
"PermGroFac": [1.00,1.00,1.00,1.00], # Permanent income growth factor
"BoroCnstArt": -1.0, # Artificial borrowing constraint
"aXtraCount": 200, # Maximum number of gridpoints in consumption function
# Parameters that characterize the nature of time
"T_cycle": 4, # Number of periods in the cycle for this agent type
"cycles": 1, # Number of times the cycle occurs (0 --> infinitely repeated)
"T_sim":4,
"AgentCount":50, #Needs to be high enough that you can find agent's dying
"aNrmInitMean":0.0,
"aNrmInitStd":0.0,
}
PerfForesightDict["Rfree"][0]=1.02 #You can check that the same problem occurs with PermGroFac and LivPrb
agent1 = PerfForesightConsumerType(**PerfForesightDict)
agent1.solve()
agent1.track_vars=["aNrm"]
agent1.initialize_sim()
agent1.simulate()
print(agent1.history["aNrm"][1:3]) #so that the agent's solution/birth should be unaffected by a past variable
PerfForesightDict["Rfree"][0]=1.03
agent2 = PerfForesightConsumerType(**PerfForesightDict)
agent2.solve()
agent2.track_vars=["aNrm"]
agent2.initialize_sim()
agent2.simulate()
print(agent2.history["aNrm"][1:3]) #so that the agent's solution/birth should be unaffected by a past variable

The aNrm values for the agents who are born in this period should differ because there's no randomness to aNrm or income, both should have the same solution and lifecycle process, and the only change is happening in the past. However, they aren't the same.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions