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

5 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. 

7LivPrb = 0.98 

8 

9calibration = { 

10 "DiscFac": 0.96, 

11 "CRRA": 2.0, 

12 "Rfree": 1.03, 

13 "LivPrb": LivPrb, 

14 "PermGroFac": 1.01, 

15 "BoroCnstArt": None, 

16} 

17 

18block = DBlock( 

19 **{ 

20 "name": "consumption", 

21 "shocks": { 

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

23 }, 

24 "dynamics": { 

25 "y": lambda p: p, 

26 "m": lambda Rfree, a, y: Rfree * a + y, 

27 "c": Control(["m"]), 

28 "p": lambda PermGroFac, p: PermGroFac * p, 

29 "a": lambda m, c: m - c, 

30 }, 

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

32 } 

33)