<jupyter_start><jupyter_text>Example notebookThis shows an example of how we have solved the model. In this example we solve for the college educated, and after that simulate the the results.<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# Ignore warnings
import warnings
warnings.filterwarnings("ignore")
from model import Model
from simulator import Simulator
from parameters import parameters as par
from modules.consumptionpreference import create_consumption_preference_array
from modules.agepolynomial import create_age_poly_array<jupyter_output><empty_output><jupyter_text>Parameters<jupyter_code>start_age = 25
educ = 'College' # Can be either '<HS', 'HS' or 'College'

par.start_age = start_age

# Change education parameters (age-polynomial income profile and number of children n)
par.age_poly = create_age_poly_array(educ)
par.n = create_consumption_preference_array(educ)<jupyter_output><empty_output><jupyter_text>Solving the model Instantiate the model<jupyter_code>m = Model()<jupyter_output><empty_output><jupyter_text>Solving the modeltakes approx. 30 minutes.<jupyter_code>V_sol, C_sol = m.solve(par)<jupyter_output>Solution is at time step t =   25<jupyter_text>Simulating the model<jupyter_code>NUMBER_OF_PERSONS = 1000
states, choices, shocks = Simulator.simulate(V_sol, C_sol, par, NUMBER_OF_PERSONS)<jupyter_output><empty_output><jupyter_text>Figures from simulation<jupyter_code>FIGSIZE = (12, 18)<jupyter_output><empty_output><jupyter_text>State Plots<jupyter_code>f, (ax1, ax2, ax3) = plt.subplots(3, 1, figsize=FIGSIZE)
ax1.set_title("Cash-on-Hand (m)")
ax1.plot(range(25, 91), states[0,:], alpha=0.1, color='orange')
ax1.plot(range(25, 91), states[0,:].mean(axis=1), color='red')

ax2.set_title("Financial Literacy (f)")
ax2.plot(range(25, 91), states[1,:], alpha=0.1, color='lightblue')
ax2.plot(range(25, 91), states[1,:].mean(axis=1), color='red')

ax3.set_title("Permanent Income (p)")
ax3.plot(range(25, 91), states[2,:], alpha=0.1, color='lightgreen')
ax3.plot(range(25, 91), states[2,:].mean(axis=1), color='red')<jupyter_output><empty_output><jupyter_text>Choice Plots<jupyter_code>f, (ax1, ax2, ax3) = plt.subplots(3, 1, figsize=FIGSIZE)
ax1.set_title("Consumption (c)")
ax1.plot(range(25, 91), choices[0,:], alpha=0.1, color='orange')
ax1.plot(range(25, 91), choices[0,:].mean(axis=1), color='red')

ax2.set_title("Investment in risky assets (kappa)")
ax2.plot(range(25, 91), choices[1,:], alpha=0.1, color='lightblue')
ax2.plot(range(25, 91), choices[1,:].mean(axis=1), color='red')

ax3.set_title("Investment in Financial Literacy (i)")
ax3.plot(range(25, 91), choices[2,:], alpha=0.1, color='lightgreen')
ax3.plot(range(25, 91), choices[2,:].mean(axis=1), color='red')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15041381792011516, 'fraction_numerical': 0.04318100035984167, 'mean_word_length': 8.686411149825783, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '251132', 'license': 'MIT', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1038, 'n_words': 214, 'path': 'src/example notebook.ipynb', 'repo_name': 'JakartaLaw/dypa_termpaper', 'size': '2779'}