Пример #1
0
 def setUp(self):
     self.SCF_wealth, self.SCF_weights = load_SCF_wealth_weights()
Пример #2
0
# NB: Because there is no permanent income growth in this model, all shocks are mean one and idiosyncratic, and we have many agents, aggregate or average income is 1.0.

# %%
aLvl_all = np.concatenate([ThisType.state_now["aLvl"] for ThisType in MyTypes])
print('The ratio of aggregate capital to permanent income is ' +
      decfmt2(np.mean(aLvl_all)))

# %% [markdown]
# ## Plotting the Lorenz Curve

# %%
# Plot Lorenz curves for model with uniform distribution of time preference
from HARK.datasets import load_SCF_wealth_weights
from HARK.utilities import get_lorenz_shares, get_percentiles

SCF_wealth, SCF_weights = load_SCF_wealth_weights()

pctiles = np.linspace(0.001, 0.999, 200)
sim_wealth = np.concatenate(
    [ThisType.state_now["aLvl"] for ThisType in MyTypes])
SCF_Lorenz_points = get_lorenz_shares(SCF_wealth,
                                      weights=SCF_weights,
                                      percentiles=pctiles)
sim_Lorenz_points = get_lorenz_shares(sim_wealth, percentiles=pctiles)
plt.plot(pctiles, SCF_Lorenz_points, '--k')
plt.plot(pctiles, sim_Lorenz_points, '-b')
plt.xlabel('Percentile of net worth')
plt.ylabel('Cumulative share of wealth')
plt.show(block=False)

# %% [markdown]