コード例 #1
0
ファイル: ComparisonTests.py プロジェクト: econ-seunghee/HARK
    def setUp(self):

        # Set up and solve infinite type
        import ConsumerParameters as Params

        InfiniteType = IndShockConsumerType(**Params.init_idiosyncratic_shocks)
        InfiniteType.assignParameters(
            LivPrb=[1.],
            DiscFac=0.955,
            PermGroFac=[1.],
            PermShkStd=[0.],
            TempShkStd=[0.],
            T_total=1,
            T_retire=0,
            BoroCnstArt=None,
            UnempPrb=0.,
            cycles=0)  # This is what makes the type infinite horizon

        InfiniteType.updateIncomeProcess()
        InfiniteType.solve()
        InfiniteType.timeFwd()
        InfiniteType.unpackcFunc()

        # Make and solve a perfect foresight consumer type
        PerfectForesightType = deepcopy(InfiniteType)
        PerfectForesightType.solveOnePeriod = solvePerfForesight

        PerfectForesightType.solve()
        PerfectForesightType.unpackcFunc()
        PerfectForesightType.timeFwd()

        self.InfiniteType = InfiniteType
        self.PerfectForesightType = PerfectForesightType
コード例 #2
0
ファイル: Comparison_UnitTests.py プロジェクト: econ-ark/HARK
    def setUp(self):
        """
        Prepare to compare the models by initializing and solving them
        """
        # Set up and solve infinite type
        import ConsumerParameters as Params
        
        InfiniteType = IndShockConsumerType(**Params.init_idiosyncratic_shocks)
        InfiniteType.assignParameters(LivPrb      = [1.],
                                      DiscFac     = 0.955,
                                      PermGroFac  = [1.],
                                      PermShkStd  = [0.],
                                      TempShkStd  = [0.],
                                      T_total = 1, T_retire = 0, BoroCnstArt = None, UnempPrb = 0.,
                                      cycles = 0) # This is what makes the type infinite horizon

        InfiniteType.updateIncomeProcess()        
        InfiniteType.solve()
        InfiniteType.timeFwd()
        InfiniteType.unpackcFunc()


        # Make and solve a perfect foresight consumer type with the same parameters
        PerfectForesightType = deepcopy(InfiniteType)    
        PerfectForesightType.solveOnePeriod = solvePerfForesight
        
        PerfectForesightType.solve()
        PerfectForesightType.unpackcFunc()
        PerfectForesightType.timeFwd()

        self.InfiniteType         = InfiniteType
        self.PerfectForesightType = PerfectForesightType