예제 #1
0
    TranShk = 1.1
    cTranImpulseResponse = AggCons_impulseResponseInd(IndShockExample, PermShk,
                                                      TranShk, 100, 25)
    plt.plot(cTranImpulseResponse)
    print(
        'Impulse response to a one time permanent and transitive shock to income of 10%:'
    )
    plt.show()

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

    # Now do aggregate shocks of a market
    # Make an aggregate shocks consumer
    AggShockExample = AggShockConsumerType(**Params.init_agg_shocks)
    AggShockExample.cycles = 0
    AggShockExample.sim_periods = 3000
    AggShockExample.makeIncShkHist(
    )  # Simulate a history of idiosyncratic shocks
    # Make a Cobb-Douglas economy for the agents
    EconomyExample = CobbDouglasEconomy(agents=[AggShockExample],
                                        act_T=AggShockExample.sim_periods,
                                        **Params.init_cobb_douglas)
    EconomyExample.makeAggShkHist()  # Simulate a history of aggregate shocks

    # Have the consumers inherit relevant objects from the economy
    AggShockExample.getEconomyData(EconomyExample)

    # Solve the microeconomic model for the aggregate shocks example type (and display results)
    t_start = clock()
    AggShockExample.solve()
    t_end = clock()
예제 #2
0
###############################################################################

if __name__ == '__main__':
    import ConsumerParameters as Params
    from time import clock
    from HARKutilities import plotFuncs
    mystr = lambda number: "{:.4f}".format(number)

    # Make an aggregate shocks sticky expectations consumer
    StickyExample = AggShockStickyExpectationsConsumerType(
        **Params.init_sticky_shocks)
    NotStickyExample = AggShockConsumerType(**Params.init_sticky_shocks)
    StickyExample.cycles = 0
    NotStickyExample.cycles = 0
    StickyExample.sim_periods = 3000
    NotStickyExample.sim_periods = 3000
    StickyExample.makeIncShkHist(
    )  # Simulate a history of idiosyncratic shocks
    NotStickyExample.makeIncShkHist(
    )  # Simulate a history of idiosyncratic shocks

    # Make a Cobb-Douglas economy for the agents
    StickyEconomyExample = CobbDouglasEconomy(agents=[StickyExample],
                                              act_T=StickyExample.sim_periods,
                                              **Params.init_cobb_douglas)
    NotStickyEconomyExample = CobbDouglasEconomy(
        agents=[NotStickyExample],
        act_T=NotStickyExample.sim_periods,
        **Params.init_cobb_douglas)
    StickyEconomyExample.makeAggShkHist(
    )  # Simulate a history of aggregate shocks