Write docstring for engines
@@ -2734,7 +2734,26 @@ class IndShockConsumerType(PerfForesightConsumerType):
def PermShk_engine(sigma, n_approx, neutral_measure=False, seed=0):
+ """
+ Constructs a one-period distribution for permanent income shock.
+
+ Parameters
+ ----------
+ sigma : float
+ Standard deviation of the log-shock.
+ n_approx : int
+ Number of points to use in the discrete approximation.
+ neutral_measure : Bool, optional
+ Whether to use Hamenberg's permanent-income-neutral measure. The default is False.
+ seed : int, optional
+ Random seed. The default is 0.
+
+ Returns
+ -------
+ PermShkDstn : DiscreteDistribution
+ Permanent income shock distribution.
+ """
PermShkDstn = MeanOneLogNormal(sigma, seed=seed).approx(n_approx, tail_N=0)
if neutral_measure:
PermShkDstn.pmf = PermShkDstn.X * PermShkDstn.pmf
@@ -2743,7 +2762,28 @@ def PermShk_engine(sigma, n_approx, neutral_measure=False, seed=0):
def TranShk_engine(sigma, UnempPrb, IncUnemp, n_approx, seed=0):
+ """
+ Contructs a one-period distribution for transitory income
+
+ Parameters
+ ----------
+ sigma : float
+ Standard deviation of the log-shock.
+ UnempPrb : float
+ Probability of the "unemployment" shock.
+ IncUnemp : float
+ Income shock in the "unemployment" state.
+ n_approx : int
+ Number of points to use in the discrete approximation.
+ seed : int, optional
+ Random seed. The default is 0.
+ Returns
+ -------
+ TranShkDstn : DiscreteDistribution
+ Transitory income shock distribution.
+
+ """
TranShkDstn = MeanOneLogNormal(sigma, seed=seed).approx(n_approx, tail_N=0)
if UnempPrb > 0:
TranShkDstn = add_discrete_outcome_constant_mean(
@@ -2763,7 +2803,35 @@ def IncShk_engine(
neutral_measure=False,
seed=0,
):
+ """
+ Contructs a one-period distribution for the joint distribution of income
+ shocks (permanent and transitory).
+
+ Parameters
+ ----------
+ sigma_Perm : float
+ Standard deviation of the log- permanent shock.
+ sigma_Tran : float
+ Standard deviation of the log- transitory shock.
+ n_approx_Perm : int
+ Number of points to use in the discrete approximation of the permanent shock.
+ n_approx_Tran : int
+ Number of points to use in the discrete approximation of the transitory shock.
+ UnempPrb : float
+ Probability of the "unemployment" shock.
+ IncUnemp : float
+ Income shock in the "unemployment" state.
+ neutral_measure : Bool, optional
+ Whether to use Hamenberg's permanent-income-neutral measure. The default is False.
+ seed : int, optional
+ Random seed. The default is 0.
+ Returns
+ -------
+ IncShkDstn : DiscreteDistribution
+ Income shock distribution.
+
+ """
PermShkDstn = PermShk_engine(sigma_Perm, n_approx_Perm, neutral_measure)
TranShkDstn = TranShk_engine(sigma_Tran, UnempPrb, IncUnemp, n_approx_Tran)
