Rm duplicated methods
@@ -735,87 +735,6 @@ class RiskyContribConsumerType(RiskyAssetConsumerType):
else:
self.addToTimeInv("tau")
- def updateRiskyDstn(self):
- """
- Creates the attributes RiskyDstn from the primitive attributes RiskyAvg,
- RiskyStd, and RiskyCount, approximating the (perceived) distribution of
- returns in each period of the cycle.
-
- Parameters
- ----------
- None
-
- Returns
- -------
- None
- """
- # Determine whether this instance has time-varying risk perceptions
- if (
- (type(self.RiskyAvg) is list)
- and (type(self.RiskyStd) is list)
- and (len(self.RiskyAvg) == len(self.RiskyStd))
- and (len(self.RiskyAvg) == self.T_cycle)
- ):
- self.addToTimeVary("RiskyAvg", "RiskyStd")
- elif (type(self.RiskyStd) is list) or (type(self.RiskyAvg) is list):
- raise AttributeError(
- "If RiskyAvg is time-varying, then RiskyStd must be as well, and they must both have length of T_cycle!"
- )
- else:
- self.addToTimeInv("RiskyAvg", "RiskyStd")
-
- # Generate a discrete approximation to the risky return distribution if the
- # agent has age-varying beliefs about the risky asset
- if "RiskyAvg" in self.time_vary:
- RiskyDstn = []
- for t in range(self.T_cycle):
- RiskyAvgSqrd = self.RiskyAvg[t] ** 2
- RiskyVar = self.RiskyStd[t] ** 2
- mu = np.log(self.RiskyAvg[t] / (np.sqrt(1.0 + RiskyVar / RiskyAvgSqrd)))
- sigma = np.sqrt(np.log(1.0 + RiskyVar / RiskyAvgSqrd))
- RiskyDstn.append(Lognormal(mu=mu, sigma=sigma).approx(self.RiskyCount))
- self.RiskyDstn = RiskyDstn
- self.addToTimeVary("RiskyDstn")
-
- # Generate a discrete approximation to the risky return distribution if the
- # agent does *not* have age-varying beliefs about the risky asset (base case)
- else:
- RiskyAvgSqrd = self.RiskyAvg ** 2
- RiskyVar = self.RiskyStd ** 2
- mu = np.log(self.RiskyAvg / (np.sqrt(1.0 + RiskyVar / RiskyAvgSqrd)))
- sigma = np.sqrt(np.log(1.0 + RiskyVar / RiskyAvgSqrd))
- self.RiskyDstn = Lognormal(mu=mu, sigma=sigma).approx(self.RiskyCount)
- self.addToTimeInv("RiskyDstn")
-
- def updateShockDstn(self):
- """
- Combine the income shock distribution (over PermShk and TranShk) with the
- risky return distribution (RiskyDstn) to make a new attribute called ShockDstn.
-
- Parameters
- ----------
- None
-
- Returns
- -------
- None
- """
- if "RiskyDstn" in self.time_vary:
- self.ShockDstn = [
- combineIndepDstns(self.IncShkDstn[t], self.RiskyDstn[t])
- for t in range(self.T_cycle)
- ]
- else:
- self.ShockDstn = [
- combineIndepDstns(self.IncShkDstn[t], self.RiskyDstn)
- for t in range(self.T_cycle)
- ]
- self.addToTimeVary("ShockDstn")
-
- # Mark whether the risky returns and income shocks are independent (they are)
- self.IndepDstnBool = True
- self.addToTimeInv("IndepDstnBool")
-
def updateShareGrid(self):
"""
Creates the attribute ShareGrid as an evenly spaced grid on [0.,1.], using
