コード例 #1
0
    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()
    print('Solving an aggregate shocks consumer took ' +
          mystr(t_end - t_start) + ' seconds.')

    #    # Solve the "macroeconomic" model by searching for a "fixed point dynamic rule"
    #    t_start = clock()
    #    EconomyExample.solve()
    #    t_end = clock()
    #    print('Solving the "macroeconomic" aggregate shocks model took ' + str(t_end - t_start) + ' seconds.')

    PermShk = 1.1
    TranShk = 1
    cMarketPermImpulseResponse = AggCons_impulseResponseAgg(
        EconomyExample, PermShk, TranShk, 100, 25)
    plt.plot(cMarketPermImpulseResponse)
コード例 #2
0
        agents=[NotStickyExample],
        act_T=NotStickyExample.sim_periods,
        **Params.init_cobb_douglas)
    StickyEconomyExample.makeAggShkHist(
    )  # Simulate a history of aggregate shocks
    NotStickyEconomyExample.makeAggShkHist(
    )  # Simulate a history of aggregate shocks

    # Have the consumers inherit relevant objects from the economy
    StickyExample.getEconomyData(StickyEconomyExample)
    NotStickyExample.getEconomyData(NotStickyEconomyExample)

    # Solve the microeconomic model for the aggregate shocks example type (and display results)
    t_start = clock()
    StickyExample.solve()
    NotStickyExample.solve()
    t_end = clock()
    print('Solving an aggregate shocks consumer took ' +
          mystr(t_end - t_start) + ' seconds.')

    #    # Solve the "macroeconomic" model by searching for a "fixed point dynamic rule"
    #    t_start = clock()
    #    StickyEconomyExample.solve()
    #    NotStickyEconomyExample.solve()
    #    t_end = clock()
    #    print('Solving the "macroeconomic" aggregate shocks model took ' + str(t_end - t_start) + ' seconds.')

    PermShk = 1.1
    TranShk = 1
    StickyImpulseResponse = AggCons_impulseResponseAgg(StickyEconomyExample,
                                                       PermShk, TranShk, 100,