#### Used in aer2 figures import numpy as np from simulations_aer2 import load_simulation from figures import saved_figure, despine, figure_defaults import pandas as p import matplotlib from pandas import ExcelWriter from matplotlib.ticker import MultipleLocator, FixedLocator baseline = load_simulation() nozlb = load_simulation(sim_dir='results/alt-sims/nozlb_2008') gdp_diff = 100*(np.log(baseline.gdp) - np.log(nozlb.gdp)) gdp_mean = gdp_diff.groupby(level=0).mean()['2007Q4':] gdp_q16 = gdp_diff.groupby(level=0).apply(lambda x: np.percentile(x, 16))['2007Q4':] gdp_q84 = gdp_diff.groupby(level=0).apply(lambda x: np.percentile(x, 84))['2007Q4':] col = figure_defaults() #nozlbq16 = nozlb.groupby(level=0).quantile(0.16)['Interest Rate']['2007Q4':] #nozlbq84 = nozlb.groupby(level=0).quantile(0.84)['Interest Rate']['2007Q4':] not_mean = baseline.groupby(level=0).mean()['Notional Rate']['2007Q4':] not_q16 = baseline.groupby(level=0)['Notional Rate'].apply(lambda x: np.percentile(x, 16))['2007Q4':] not_q84 = baseline.groupby(level=0)['Notional Rate'].apply(lambda x: np.percentile(x, 84))['2007Q4':]
#### Used in aer2 figures from simulations_aer2 import load_simulation, date_index, sim_dir from figures import saved_figure, despine, figure_defaults import numpy as np import pandas as p from pandas import ExcelWriter from matplotlib.ticker import MultipleLocator, FixedLocator baseline = load_simulation() mean = baseline.groupby(level=0).mean()['2008':] q16 = baseline.groupby(level=0).quantile(0.16)['2008':] q84 = baseline.groupby(level=0).quantile(0.84)['2008':] #shocks = ['scaled_liq', 'scaled_inv', 'techdev'] #names = {'scaled_liq': 'Risk Premium Shock', # 'scaled_inv': 'MEI Shock', # 'techdev': 'Technology Shock'} ebp = p.read_csv('data/GLZ_variables.csv', index_col=0, parse_dates=True).ebp_oa ebpq = ebp.resample('Q', how=lambda x: x[-1]) ebpq = ebpq / ebpq.std() baa = p.read_csv('data/Baaspread10y.csv', index_col=0, parse_dates=True).baa baaq = baa.resample('Q', how=lambda x: x[-1])
from model import data from simulations_aer2 import load_simulation from simulations import load_simulation_old from figures import saved_figure, despine, figure_defaults import pandas as p from pandas import ExcelWriter from matplotlib.ticker import MultipleLocator, FixedLocator import matplotlib sim_dir_low_me = 'results/low-me/smoothed-states/' smoothed_states = load_simulation() smoothed_states_low_me = load_simulation(sim_dir=sim_dir_low_me) smoothed_states['techdev'] = smoothed_states['Technology Level'] - smoothed_states['Technology Det'] smoothed_states_low_me['techdev'] = smoothed_states_low_me['Technology Level'] - smoothed_states_low_me['Technology Det'] mean = smoothed_states.groupby(level=0).mean() q16 = smoothed_states.groupby(level=0).quantile(0.16) q84 = smoothed_states.groupby(level=0).quantile(0.84) mean_low_me = smoothed_states_low_me.groupby(level=0).mean() q16_low_me = smoothed_states_low_me.groupby(level=0).quantile(0.16) q84_low_me = smoothed_states_low_me.groupby(level=0).quantile(0.84)
from model import data from simulations_aer2 import load_simulation from figures import saved_figure, despine, figure_defaults import pandas as p import numpy as np import matplotlib from matplotlib.ticker import MultipleLocator, FixedLocator from pandas import ExcelWriter smoothed_states = load_simulation() mean = smoothed_states.groupby(level=0).mean() q16 = smoothed_states.groupby(level=0).quantile(0.16) q84 = smoothed_states.groupby(level=0).quantile(0.84) to_plot = [ 'Output Growth', 'Investment Growth', 'Consumption Growth', 'Inflation', 'Interest Rate', 'Notional Rate' ] col = figure_defaults() with saved_figure('observable_fit.pdf', nrows=3, ncols=2) as (fig, ax): xlabels = p.PeriodIndex(range(1985, 2016, 5), freq='A') for axi, obs in zip(ax.reshape(-1), to_plot):
### Using in aer2 revision import numpy as np from simulations_aer2 import load_simulation from figures import saved_figure, despine, figure_defaults import pandas as p from pandas import ExcelWriter from matplotlib.ticker import MultipleLocator, FixedLocator import matplotlib baseline = load_simulation().groupby(level=0).mean()['2008':] only_liq = load_simulation(sim_dir='results/alt-sims/great_recession_liq').groupby(level=0).mean()['2008':] only_inv = load_simulation(sim_dir='results/alt-sims/great_recession_inv').groupby(level=0).mean()['2008':] only_tech = load_simulation(sim_dir='results/alt-sims/great_recession_tech').groupby(level=0).mean()['2008':] to_plot = ['Output Growth', 'Investment Growth', 'Consumption Growth', 'Inflation', 'Interest Rate', 'Notional Rate'] col = figure_defaults() with saved_figure('drivers_of_gr.pdf', nrows=3, ncols=2) as (fig, ax):