Skip to content

Commit

Permalink
Merge branch 'master' into i538
Browse files Browse the repository at this point in the history
  • Loading branch information
sbenthall authored Apr 30, 2020
2 parents 3c9c81a + 0bb26c5 commit e18813a
Show file tree
Hide file tree
Showing 12 changed files with 1,242 additions and 196 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,9 @@ Web
# Mac system files
.DS_Store

# Emacs automatic backup files
# Emacs automatic backup and hash files
*~
\#*#

# Vim swap files
*.swp
Expand Down
22 changes: 15 additions & 7 deletions HARK/ConsumptionSaving/ConsAggShockModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from builtins import range
import numpy as np
import scipy.stats as stats
from HARK.distribution import DiscreteDistribution, combineIndepDstns, approxMeanOneLognormal
from HARK.distribution import DiscreteDistribution, combineIndepDstns, MeanOneLogNormal
from HARK.interpolation import LinearInterp, LinearInterpOnInterp1D, ConstantFunction, IdentityFunction,\
VariableLowerBoundFunc2D, BilinearInterp, LowerEnvelope2D, UpperEnvelope
from HARK.utilities import CRRAutility, CRRAutilityP, CRRAutilityPP, CRRAutilityP_inv,\
Expand Down Expand Up @@ -1095,8 +1095,12 @@ def makeAggShkDstn(self):
-------
None
'''
self.TranShkAggDstn = approxMeanOneLognormal(sigma=self.TranShkAggStd, N=self.TranShkAggCount)
self.PermShkAggDstn = approxMeanOneLognormal(sigma=self.PermShkAggStd, N=self.PermShkAggCount)
self.TranShkAggDstn = MeanOneLogNormal(
sigma=self.TranShkAggStd
).approx(N=self.TranShkAggCount)
self.PermShkAggDstn = MeanOneLognormal(
sigma=self.PermShkAggStd
).approx(N=self.PermShkAggCount)
self.AggShkDstn = combineIndepDstns(self.PermShkAggDstn, self.TranShkAggDstn)

def reset(self):
Expand Down Expand Up @@ -1312,8 +1316,12 @@ def makeAggShkDstn(self):
-------
None
'''
self.TranShkAggDstn = approxMeanOneLognormal(sigma=self.TranShkAggStd, N=self.TranShkAggCount)
self.PermShkAggDstn = approxMeanOneLognormal(sigma=self.PermShkAggStd, N=self.PermShkAggCount)
self.TranShkAggDstn = MeanOneLogNormal(
sigma=self.TranShkAggStd
).approx(N=self.TranShkAggCount)
self.PermShkAggDstn = MeanOneLogNormal(
sigma=self.PermShkAggStd
).approx(N=self.PermShkAggCount)
self.AggShkDstn = combineIndepDstns(self.PermShkAggDstn, self.TranShkAggDstn)

def millRule(self):
Expand Down Expand Up @@ -1526,8 +1534,8 @@ def makeAggShkDstn(self):
StateCount = self.MrkvArray.shape[0]

for i in range(StateCount):
TranShkAggDstn.append(approxMeanOneLognormal(sigma=self.TranShkAggStd[i], N=self.TranShkAggCount))
PermShkAggDstn.append(approxMeanOneLognormal(sigma=self.PermShkAggStd[i], N=self.PermShkAggCount))
TranShkAggDstn.append(MeanOneLogNormal(sigma=self.TranShkAggStd[i]).approx(N=self.TranShkAggCount))
PermShkAggDstn.append(MeanOneLogNormal(sigma=self.PermShkAggStd[i]).approx(N=self.PermShkAggCount))
AggShkDstn.append(combineIndepDstns(PermShkAggDstn[-1], TranShkAggDstn[-1]))

self.TranShkAggDstn = TranShkAggDstn
Expand Down
32 changes: 22 additions & 10 deletions HARK/ConsumptionSaving/ConsIndShockModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
from HARK import AgentType, Solution, NullFunc, HARKobject
from HARK.utilities import warnings # Because of "patch" to warnings modules
from HARK.interpolation import CubicInterp, LowerEnvelope, LinearInterp
from HARK.distribution import Lognormal, Uniform
from HARK.distribution import DiscreteDistribution, approxMeanOneLognormal, addDiscreteOutcomeConstantMean, combineIndepDstns
from HARK.distribution import Lognormal, MeanOneLogNormal, Uniform
from HARK.distribution import DiscreteDistribution, addDiscreteOutcomeConstantMean, combineIndepDstns
from HARK.utilities import makeGridExpMult, CRRAutility, CRRAutilityP, \
CRRAutilityPP, CRRAutilityP_inv, CRRAutility_invP, CRRAutility_inv, \
CRRAutilityP_invP
Expand Down Expand Up @@ -2257,11 +2257,19 @@ def makeEulerErrorFunc(self,mMax=100,approx_inc_dstn=True):
if approx_inc_dstn:
IncomeDstn = self.IncomeDstn[0]
else:
TranShkDstn = approxMeanOneLognormal(N=200,sigma=self.TranShkStd[0],
tail_N=50,tail_order=1.3, tail_bound=[0.05,0.95])
TranShkDstn = MeanOneLognormal(
sigma=self.TranShkStd[0]
).approx(N=200,
tail_N=50,
tail_order=1.3,
tail_bound=[0.05,0.95])
TranShkDstn = addDiscreteOutcomeConstantMean(TranShkDstn,self.UnempPrb,self.IncUnemp)
PermShkDstn = approxMeanOneLognormal(N=200,sigma=self.PermShkStd[0],
tail_N=50,tail_order=1.3, tail_bound=[0.05,0.95])
PermShkDstn = MeanOneLogNormal(
sigma=self.PermShkStd[0]
).approx(N=200,
tail_N=50,
tail_order=1.3,
tail_bound=[0.05,0.95])
IncomeDstn = combineIndepDstns(PermShkDstn,TranShkDstn)

# Make a grid of market resources
Expand Down Expand Up @@ -2634,10 +2642,16 @@ def constructLognormalIncomeProcessUnemployment(self):
TranShkDstn.append([ShkPrbsRet,TranShkValsRet])
else:
# We are in the "working life" periods.
TranShkDstn_t = approxMeanOneLognormal(N=TranShkCount, sigma=TranShkStd[t], tail_N=0)
TranShkDstn_t = MeanOneLogNormal(
sigma=TranShkStd[t]
).approx(TranShkCount, tail_N=0)
if UnempPrb > 0:
TranShkDstn_t = addDiscreteOutcomeConstantMean(TranShkDstn_t, p=UnempPrb, x=IncUnemp)
PermShkDstn_t = approxMeanOneLognormal(N=PermShkCount, sigma=PermShkStd[t], tail_N=0)
PermShkDstn_t = MeanOneLogNormal(
sigma=PermShkStd[t]
).approx(PermShkCount, tail_N=0)
### REPLACE
###REPLACE
IncomeDstn.append(combineIndepDstns(PermShkDstn_t,TranShkDstn_t)) # mix the independent distributions
PermShkDstn.append(PermShkDstn_t)
TranShkDstn.append(TranShkDstn_t)
Expand Down Expand Up @@ -2809,8 +2823,6 @@ def checkConditions(self,verbose=False):
'''
raise NotImplementedError()



def applyFlatIncomeTax(IncomeDstn,tax_rate,T_retire,unemployed_indices=[],transitory_index=2):
'''
Applies a flat income tax rate to all employed income states during the working
Expand Down
Loading

0 comments on commit e18813a

Please sign in to comment.