Ejemplo n.º 1
0
            # Simulate the frictionless small open economy
            t_start = clock()
            for agent in StickySOEconomy.agents:
                agent(UpdatePrb=1.0)
            StickySOEconomy.makeHistory()
            t_end = clock()
            print('Simulating the frictionless small open economy took ' +
                  mystr(t_end - t_start) + ' seconds.')

            # Make results for the frictionless representative agent economy
            desc = 'Results for the frictionless small open economy (update probability 1.0)'
            name = 'SOEsimpleFrictionless'
            makeStickyEdataFile(StickySOEconomy,
                                ignore_periods,
                                description=desc,
                                filename=name,
                                save_data=save_data,
                                calc_micro_stats=calc_micro_stats)

            # Simulate the sticky small open economy
            t_start = clock()
            for agent in StickySOEconomy.agents:
                agent(UpdatePrb=Params.UpdatePrb)
            StickySOEconomy.makeHistory()
            t_end = clock()
            print('Simulating the sticky small open economy took ' +
                  mystr(t_end - t_start) + ' seconds.')

            # Make results for the sticky small open economy
            desc = 'Results for the sticky small open economy with update probability ' + mystr(
                Params.UpdatePrb)
            plt.plot(m,c[i,:])
        plt.show()
            
        # Simulate the sticky small open Markov economy
        t_start = clock()
        for agent in StickySOmarkovEconomy.agents:
            agent(UpdatePrb = Params.UpdatePrb)
            agent(SocialPrb = Params.SocialPrb)
            agent(NetSiz = NetSiz)
        StickySOmarkovEconomy.makeHistory()
        t_end = clock()
        print('Simulating the sticky small open Markov economy took ' + mystr(t_end-t_start) + ' seconds.')
        # Make results for the sticky small open Markov economy
        desc = 'Results for the sticky small open Markov economy with update probability ' + mystr(Params.UpdatePrb)
        name = 'SOEmarkovSticky'
        makeStickyEdataFile(StickySOmarkovEconomy,ignore_periods,description=desc,filename=name,save_data=save_data,calc_micro_stats=calc_micro_stats)
        if calc_micro_stats:
            sticky_SOEmarkov_micro_data = extractSampleMicroData(StickySOmarkovEconomy, np.minimum(StickySOmarkovEconomy.act_T-ignore_periods-1,periods_to_sim_micro), np.minimum(StickySOmarkovEconomy.agents[0].AgentCount,AgentCount_micro), ignore_periods)
        DeltaLogC_stdev = np.genfromtxt(results_dir + 'SOEmarkovStickyResults.csv', delimiter=',')[3]    
        Deltalogc_stdev=np.nanstd(sticky_SOEmarkov_micro_data[:,0])
        C_std.append(DeltaLogC_stdev)
        c_std.append(Deltalogc_stdev)

#############################################################
    DeltaLogC_stdev_frictionless=0.010551994946000001
    DeltaLogc_stdev_frictionless=0.060693527772294961
    DeltaLogC_stdev_sticky=0.00681149331603
    Deltalogc_stdev_sticky=0.061464262113268463
    Var_C_frictionless=DeltaLogC_stdev_frictionless**2
    Var_c_frictionless=DeltaLogc_stdev_frictionless**2
    Var_C_Sticky=DeltaLogC_stdev_sticky**2
Ejemplo n.º 3
0
                c[i,:] = StickySOEmarkovConsumers[0].solution[0].cFunc[i](m,M)
                plt.plot(m,c[i,:])
            plt.show()

            # Simulate the sticky small open Markov economy
            t_start = clock()
            for agent in StickySOmarkovEconomy.agents:
                agent(UpdatePrb = Params.UpdatePrb)
            StickySOmarkovEconomy.makeHistory()
            t_end = clock()
            print('Simulating the sticky small open Markov economy took ' + mystr(t_end-t_start) + ' seconds.')

            # Make results for the sticky small open Markov economy
            desc = 'Results for the sticky small open Markov economy with update probability ' + mystr(Params.UpdatePrb)
            name = 'SOEmarkovSticky'
            makeStickyEdataFile(StickySOmarkovEconomy,ignore_periods,description=desc,filename=name,save_data=save_data,calc_micro_stats=calc_micro_stats)
            if calc_micro_stats:
                sticky_SOEmarkov_micro_data = extractSampleMicroData(StickySOmarkovEconomy, np.minimum(StickySOmarkovEconomy.act_T-ignore_periods-1,periods_to_sim_micro), np.minimum(StickySOmarkovEconomy.agents[0].AgentCount,AgentCount_micro), ignore_periods)
            DeltaLogC_stdev = np.genfromtxt(results_dir + 'SOEmarkovStickyResults.csv', delimiter=',')[3] # For use in frictionless spec

            # Simulate the frictionless small open Markov economy
            t_start = clock()
            for agent in StickySOmarkovEconomy.agents:
                agent(UpdatePrb = 1.0)
            StickySOmarkovEconomy.makeHistory()
            t_end = clock()
            print('Simulating the frictionless small open Markov economy took ' + mystr(t_end-t_start) + ' seconds.')

            # Make results for the frictionless small open Markov economy
            desc = 'Results for the frictionless small open Markov economy (update probability 1.0)'
            name = 'SOEmarkovFrictionless'