Skip to content

Commit

Permalink
use Lognormal.from_mean_std in RiskyAsset forward simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
sbenthall committed Jun 18, 2021
1 parent 085ea3a commit 4a509fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 2 additions & 6 deletions HARK/ConsumptionSaving/ConsRiskyAssetModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,9 @@ def get_Risky(self):
else:
RiskyAvg = self.RiskyAvg
RiskyStd = self.RiskyStd
RiskyAvgSqrd = RiskyAvg ** 2
RiskyVar = RiskyStd ** 2

mu = np.log(RiskyAvg / (np.sqrt(1.0 + RiskyVar / RiskyAvgSqrd)))
sigma = np.sqrt(np.log(1.0 + RiskyVar / RiskyAvgSqrd))
self.shocks["Risky"] = Lognormal(
mu, sigma, seed=self.RNG.randint(0, 2 ** 31 - 1)
self.shocks["Risky"] = Lognormal.from_mean_std(
self.RiskyAvg, self.RiskyStd, seed=self.RNG.randint(0, 2 ** 31 - 1)
).draw(1)

def get_Adjust(self):
Expand Down
8 changes: 4 additions & 4 deletions HARK/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ class Lognormal(Distribution):
Parameters
----------
mu : float or [float]
One or more means. Number of elements T in mu determines number
of rows of output.
One or more means of underlying normal distribution.
Number of elements T in mu determines number of rows of output.
sigma : float or [float]
One or more standard deviations. Number of elements T in sigma
determines number of rows of output.
One or more standard deviations of underlying normal distribution.
Number of elements T in sigma determines number of rows of output.
seed : int
Seed for random number generator.
"""
Expand Down

0 comments on commit 4a509fb

Please sign in to comment.