def simBirth(self, which_agents):
     '''
     Makes new consumers for the given indices.  Slightly extends base method by also setting
     pLvlErrNow = 1.0 for new agents, indicating that they correctly perceive their productivity.
     
     Parameters
     ----------
     which_agents : np.array(Bool)
         Boolean array of size self.AgentCount indicating which agents should be "born".
     
     Returns
     -------
     None
     '''
     AggShockConsumerType.simBirth(self, which_agents)
     if hasattr(self, 'pLvlErrNow'):
         self.pLvlErrNow[which_agents] = 1.0
         #self.pSocial[which_agents] = (self.pSocial[which_agents]*float(2*self.NetSiz+1)-self.Pcvd[which_agents]+self.PlvlAggNow)/(2*self.NetSiz+1)
         self.PSocial[which_agents] = self.PlvlAggNow
         self.Pcvd[which_agents] = self.PlvlAggNow
         self.Pcvd_pre[which_agents] = self.PlvlAggNow
         self.pInd[which_agents] = 1.0
         self.pLvlNow[which_agents] = self.PlvlAggNow
     else:
         self.pLvlErrNow = np.ones(self.AgentCount)
         self.PSocial = np.ones(self.AgentCount)
         self.Pcvd = np.ones(self.AgentCount)
         self.Pcvd_pre = np.ones(self.AgentCount)
         self.pInd = np.ones(self.AgentCount)
コード例 #2
0
ファイル: StickyEmodel.py プロジェクト: zhangtl09/HARK
 def simBirth(self, which_agents):
     '''
     Makes new consumers for the given indices.  Slightly extends base method by also setting
     pLvlErrNow = 1.0 for new agents, indicating that they correctly perceive their productivity.
     
     Parameters
     ----------
     which_agents : np.array(Bool)
         Boolean array of size self.AgentCount indicating which agents should be "born".
     
     Returns
     -------
     None
     '''
     AggShockConsumerType.simBirth(self, which_agents)
     if hasattr(self, 'pLvlErrNow'):
         self.pLvlErrNow[which_agents] = 1.0
     else:
         self.pLvlErrNow = np.ones(self.AgentCount)