Coverage for HARK/models/perfect_foresight_normalized.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-11-02 05:14 +0000

1from HARK.distributions import Bernoulli 

2from HARK.model import Control, DBlock 

3 

4# This way of distributing parameters across the scope is clunky 

5# Can be handled better if parsed from a YAML file, probably 

6# But it would be better to have a more graceful Python version as well. 

7CRRA = (2.0,) 

8LivPrb = 0.98 

9 

10calibration = { 

11 "DiscFac": 0.96, 

12 "CRRA": CRRA, 

13 "Rfree": 1.03, 

14 "LivPrb": LivPrb, 

15 "PermGroFac": 1.01, 

16 "BoroCnstArt": None, 

17} 

18 

19block = DBlock( 

20 **{ 

21 "shocks": { 

22 "live": Bernoulli(p=LivPrb), 

23 }, 

24 "dynamics": { 

25 "p": lambda PermGroFac, p: PermGroFac * p, 

26 "r_eff": lambda Rfree, PermGroFac: Rfree / PermGroFac, 

27 "b_nrm": lambda r_eff, a_nrm: r_eff * a_nrm, 

28 "m_nrm": lambda b_nrm: b_nrm + 1, 

29 "c_nrm": Control(["m_nrm"]), 

30 "a_nrm": lambda m_nrm, c_nrm: m_nrm - c_nrm, 

31 }, 

32 "reward": {"u": lambda c: c ** (1 - CRRA) / (1 - CRRA)}, 

33 } 

34)