econ-ark / HARK

Heterogenous Agents Resources & toolKit
Apache License 2.0
333 stars 198 forks source link

Default's for MarkovConsumerType don't work. #1478

Open DominicWC opened 2 months ago

DominicWC commented 2 months ago

Describe the bug The default constructor for the income distributions for MarkovConsumerType don't create unique distributions for each state, leading HARK to throw an error.

To Reproduce Run:

from HARK.ConsumptionSaving.ConsMarkovModel import MarkovConsumerType MarkovExample = MarkovConsumerType() MarkovExample.solve()

Expected behavior The model should solve without issue.

Error message: File ~\Desktop\Econ Ark Work\HARK\HARK\ConsumptionSaving\ConsMarkovModel.py:821, in MarkovConsumerType.check_markov_inputs(self) [819] for IncShkDstn_t in self.IncShkDstn: [820] if not isinstance(IncShkDstn_t, list): --> [821] raise ValueError( [822] "self.IncShkDstn is time varying and so must be a list" [823] + "of lists of Distributions, one per Markov State. Found " [824] + f"{self.IncShkDstn} instead" [825] ) [826] elif len(IncShkDstn_t) != StateCount: [827] raise ValueError( [828] "List in IncShkDstn is not the right length, it should be length equal to number of states" [829] )

ValueError: self.IncShkDstn is time varying and so must be a listof lists of Distributions, one per Markov State. Found <HARK.distribution.IndexDistribution object at 0x00000244DDBA7AD0> instead

DominicWC commented 2 months ago

Markov Consumer Type also doesn't accept a time-varying Rfree like most other models do.