###############################################################################

# -----------------------------------------------------------------------------
# ----- Define additional parameters for the persistent shocks model ----------
# -----------------------------------------------------------------------------

pLvlPctiles = np.concatenate((
    [0.001, 0.005, 0.01, 0.03],
    np.linspace(0.05, 0.95, num=19),
    [0.97, 0.99, 0.995, 0.999],
))
PrstIncCorr = 0.98  # Serial correlation coefficient for permanent income

# Make a dictionary for the "explicit permanent income" idiosyncratic shocks model
init_explicit_perm_inc = init_idiosyncratic_shocks.copy()
init_explicit_perm_inc["pLvlPctiles"] = pLvlPctiles
init_explicit_perm_inc["PermGroFac"] = [
    1.0
]  # long run permanent income growth doesn't work yet
init_explicit_perm_inc["aXtraMax"] = 30
init_explicit_perm_inc["aXtraExtra"] = [0.005, 0.01]


class GenIncProcessConsumerType(IndShockConsumerType):
    """
    A consumer type with idiosyncratic shocks to persistent and transitory income.
    His problem is defined by a sequence of income distributions, survival prob-
    abilities, and persistent income growth functions, as well as time invariant
    values for risk aversion, discount factor, the interest rate, the grid of
    end-of-period assets, and an artificial borrowing constraint.
Пример #2
0

    def getControls(self):
        '''
        Calculates consumption for the representative agent using the consumption functions.

        Parameters
        ----------
        None

        Returns
        -------
        None
        '''
        t = self.t_cycle[0]
        i = self.MrkvNow[0]
        self.cNrmNow = self.solution[t].cFunc[i](self.mNrmNow)

# Define the default dictionary for a representative agent type
init_rep_agent = init_idiosyncratic_shocks.copy()
init_rep_agent["DeprFac"] = 0.05
init_rep_agent["CapShare"] = 0.36
init_rep_agent["UnempPrb"] = 0.0
init_rep_agent["LivPrb"] = [1.0]

# Define the default dictionary for a markov representative agent type
init_markov_rep_agent = init_rep_agent.copy()
init_markov_rep_agent["PermGroFac"] = [[0.97, 1.03]]
init_markov_rep_agent["MrkvArray"] = np.array([[0.99, 0.01], [0.01, 0.99]])
init_markov_rep_agent["MrkvNow"] = 0
Пример #3
0
        vFuncFxd_now = None

    # Create and return this period's solution
    return PortfolioSolution(cFuncAdj=cFuncAdj_now,
                             ShareFuncAdj=ShareFuncAdj_now,
                             vPfuncAdj=vPfuncAdj_now,
                             vFuncAdj=vFuncAdj_now,
                             cFuncFxd=cFuncFxd_now,
                             ShareFuncFxd=ShareFuncFxd_now,
                             dvdmFuncFxd=dvdmFuncFxd_now,
                             dvdsFuncFxd=dvdsFuncFxd_now,
                             vFuncFxd=vFuncFxd_now)


# Make a dictionary to specify a portfolio choice consumer type
init_portfolio = init_idiosyncratic_shocks.copy()
init_portfolio['RiskyAvg'] = 1.08  # Average return of the risky asset
init_portfolio['RiskyStd'] = 0.20  # Standard deviation of (log) risky returns
init_portfolio[
    'RiskyCount'] = 5  # Number of integration nodes to use in approximation of risky returns
init_portfolio[
    'ShareCount'] = 25  # Number of discrete points in the risky share approximation
init_portfolio[
    'AdjustPrb'] = 1.0  # Probability that the agent can adjust their risky portfolio share each period
init_portfolio[
    'DiscreteShareBool'] = False  # Flag for whether to optimize risky share on a discrete grid only

# Adjust some of the existing parameters in the dictionary
init_portfolio['aXtraMax'] = 100  # Make the grid of assets go much higher...
init_portfolio['aXtraCount'] = 200  # ...and include many more gridpoints...
init_portfolio[
Пример #4
0
        ----------
        None

        Returns
        -------
        None
        """
        IndShockConsumerType.get_shocks(self)
        self.get_Risky()
        self.get_Adjust()


# %% Initial parameter sets

# %% Base risky asset dictionary

risky_asset_parms = {
    # Risky return factor moments. Based on SP500 real returns from Shiller's
    # "chapter 26" data, which can be found at http://www.econ.yale.edu/~shiller/data.htm
    "RiskyAvg": 1.080370891,
    "RiskyStd": 0.177196585,
    # Number of integration nodes to use in approximation of risky returns
    "RiskyCount": 5,
    # Probability that the agent can adjust their portfolio each period
    "AdjustPrb": 1.0,
}

# Make a dictionary to specify a risky asset consumer type
init_risky_asset = init_idiosyncratic_shocks.copy()
init_risky_asset.update(risky_asset_parms)