Open In Colab

Uncertain Expansion Example Notebook#

1 Preliminaries #

1.1 Model Setup#

\[ \begin{align} X_{t+1} \left( \mathsf{q} \right) = & \hspace{.2cm} \psi^x \left[D_t \left( \mathsf{q} \right), X_{t} \left( \mathsf{q} \right), {\sf q} W_{t+1}, {\sf q} \right], \cr \log G_{t+1} \left( \mathsf{q} \right) - \log G_t \left( \mathsf{q} \right) = & \hspace{.2cm} \psi^g \left[ D_t \left( \mathsf{q} \right), X_{t} \left( \mathsf{q}, \right), {\sf q} W_{t+1}, {\sf q} \right], \cr {\widehat C}_t \left( \mathsf{q} \right) = & \hspace{.2cm} \kappa \left[D_t \left( \mathsf{q} \right), X_{t} \left( \mathsf{q} \right) \right] + {\widehat G}_t \left( \mathsf{q} \right). \end{align} \]

In addition, there are a set of first-order conditions and co-state equations detailed in Chapter 8 of the book. These are compiled automatically by the code.

1.2 Inputs#

The Expansion Suite uses the function uncertain_expansion to approximate a solution to the above system locally. The user must specify several sets of inputs. Define the relevant variables:

Input

Description

Notation in text

control_variables

Variables chosen by the decision-maker at time \(t\)

\(D_t\)

state_variables

Variables that describe the current state of the system

\(X_t\)

shock_variables

Variables representing different entries of the Brownian motion variable

\(W_t\)

The \(t+1\) variables will be automatically created from this. For example, if a state variable is inputted as Z_t, an additional state variable Z_tp1 will be automatically generated. We also need to define the equilibrium conditions:

Input

Description

Notation in text

kappa

Log share of capital not allocated to consumption

\(\kappa(X_t(q),D_t(q))\)

growth

Law of motion for \(\hat{G}_{t+1}-\hat{G}_t\)

\(\psi^g(D_t(q),X_t(q),qW_{t+1},q)\)

state_equations

Law of motion for state variables

\(\psi^x(D_t(q),X_t(q),qW_{t+1},q)\)

The remaining equilibrium conditions will be automatically computed by the code. The user must also define a list of parameters and their corresponding values. This can be done by specifying pairs of inputs such as beta = 0.99 or gamma = 1.01 within the body of the function create_args.

Note that the user must define the variables and parameters before defining the equations. Make sure that the equations use the same expressions for variables and parameters as previously defined by the user.

The output is of class ModelSolution, which stores the coefficients for the linear-quadratic approximation for the jump and state variables; continuation values; consumption growth; and log change of measure, as well as the steady-state values of each variables.


2 Example#

We will now walk through the computation using the example above. Begin by installing the following libraries and downloading RiskUncertaintyValue, which contains the functions required to solve the model:

import os
import sys
import sympy as sp
workdir = os.getcwd()
# !git clone https://github.com/lphansen/RiskUncertaintyValue 
workdir = os.getcwd() + '/RiskUncertaintyValue'             
sys.path.insert(0, workdir+'/src')                        
import numpy as np
import seaborn as sns
import autograd.numpy as anp
from scipy import optimize
np.set_printoptions(suppress=True)
np.set_printoptions(linewidth=200)
from IPython.display import display, HTML
from BY_example_sol import disp
display(HTML("<style>.container { width:97% !important; }</style>"))
import warnings
warnings.filterwarnings("ignore")
import matplotlib.pyplot as plt
from scipy.stats import norm

from lin_quad import LinQuadVar
from lin_quad_util import E, concat, next_period, cal_E_ww, lq_sum, N_tilde_measure, E_N_tp1, log_E_exp, kron_prod, distance
from utilities import mat, vec, sym
from uncertain_expansion import uncertain_expansion, generate_symbols_and_args, compile_equations, get_parameter_value, \
    generate_ss_function, automate_step_1, change_parameter_value
from elasticity import exposure_elasticity, price_elasticity
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
np.set_printoptions(suppress=True)
import pickle
import pandas as pd
from scipy.optimize import fsolve
# import sympy as sp

2.1 Parameters#

Use the following function to define and set the values for your parameters.

def create_args():
    # Define parameters here
    sigma_k1 = 0.92 * anp.sqrt(3)
    sigma_k2 = 0.4 * anp.sqrt(3)
    sigma_k3 = 0.0
    sigma_z1 = 0.0
    sigma_z2 = 5.7 * anp.sqrt(3)
    sigma_z3 = 0.0
    sigma_y1 = 0.0
    sigma_y2 = 0.0
    sigma_y3 = 0.00031 * anp.sqrt(3)
    
    # Base parameters
    delta = 0.01/4
    a = 0.0922
    epsilon = 1.0
    gamma = 1.001                        #Do not change this name
    rho = 1.001                            #Do not change this name
    beta = anp.exp(-epsilon * delta)     #Do not change this name
    
    # Capital evolution parameters
    phi_1 = 1 / 8 /4
    phi_2 = 8.0
    beta_k = 0.04 /4
    alpha_k = 0.04 /4
    
    # Other states
    beta_z = 0.056 /4
    beta_2 = 0.194 /4
    mu_2 = 6.3 * (10**(-6))
    
    # Return as a dictionary
    return locals()

2.2 Variables#

Define your variables as below. You may only have one growth variable and one perturbation variable. Apart from this, you may add more variables to the list as you wish.

Control variable : \(i = \frac{I_{k,t}}{K_t}\)

State variable: \(X = [Z_1, Z_2]\)

# Define variable names
control_variables = ["imk_t"]
state_variables = ["Z_t", "Y_t"]
growth_variables = ["log_gk_t"]
perturbation_variable = ["q_t"]
shock_variables = ["W1_t", "W2_t", "W3_t"]

The user does not need to change the following code, which creates symbols for the defined parameters and variables.

parameter_names, args = generate_symbols_and_args(create_args)
globals().update(parameter_names)
variables = control_variables + state_variables + growth_variables + perturbation_variable + shock_variables
variables_tp1 = [var + "p1" for var in variables]
symbols = {var: sp.Symbol(var) for var in variables + variables_tp1}
globals().update(symbols)  

2.3 Define Equilibrium Conditions#

Ensure that you use the same names for your variables and parameters from before. You must have one output constraint and one capital growth equation, but you may add as many state equations as you wish. The first-order conditions and co-state equations will be automatically handled and do not need to be specified.

State variables, growth variable and consumption-capital ratio:

\[\begin{split} X_t = [Z_1, Z_2]\\ \hat G = \log K\\ \hat C_t - \hat G_t = \kappa(D_t, X_t) \end{split}\]

The evolution equations:

\[\begin{split} \begin{aligned} X_{t+1} =& \psi^x (D_t(q), X_t(q), qW_{t+1}, q) \\ \hat G_{t+1} - \hat G_{t} =& \psi^g (D_t(q), X_t(q), qW_{t+1}, q)\\ \kappa(D_t, X_t) =& \log{\alpha-D_t} \end{aligned} \end{split}\]
# Output constraint
kappa = sp.log(a - imk_t)

# Capital growth equation
growth = epsilon * (phi_1 * sp.log(1. + phi_2 * imk_t) - alpha_k + beta_k * Z_t \
                      - q_t**2 * 0.5 * (sigma_k1**2 + sigma_k2**2 + sigma_k3**2) * sp.exp(Y_t)) \
                      + sp.sqrt(epsilon) * sp.exp(0.5 * Y_t) * (sigma_k1 * W1_tp1 + sigma_k2 * W2_tp1 + sigma_k3 * W3_tp1)       

# Technology growth equation
technology_growth = Z_t - epsilon * beta_z * Z_t \
                                + sp.sqrt(epsilon) * sp.exp(0.5 * Y_t) * (sigma_z1 * W1_tp1 + sigma_z2 * W2_tp1 + sigma_z3 * W3_tp1)

# Volatility growth equation
volatility_growth = Y_t - epsilon * beta_2 * (1 - mu_2 * sp.exp(-Y_t)) \
                          - q_t**2 * 0.5 * (sigma_y1**2 + sigma_y2**2 + sigma_y3**2) * sp.exp(-Y_t) * epsilon \
                          + sp.exp(-0.5 * Y_t) * (sigma_y1 * W1_tp1 + sigma_y2 * W2_tp1 + sigma_y3 * W3_tp1) * sp.sqrt(epsilon)

# State equations
state_equations = [technology_growth, volatility_growth]

2.4 Code Settings#

You may additionally set the following:

  • Initial guess for steady-state variables. This must have the same length as the number of variables

  • Recursive terms initialization. These are initializations for terms like \(\log N_t^*\) and \(\hat{R}_t-\hat{V}_t\), which may be loaded from a previous solution.

  • Convergence tolerance. How small the maximum error across the approximated terms must be before the algorithm is considered to have converged.

  • Maximum iterations. The maximum number of iterations for the algorithm can take.

  • Save location. Save the model solution to this location so that it can be accessed later.

The order of the initial guess is as follows: $\( \left[ {\widehat V_t} - {\widehat C_t}, \widehat C_t - \widehat K_t, D_t, MX_t, MG_t, \widehat G_{t+1} - \widehat G_t, X_t \right] \)$

# Initial guess for the solution: the order is:

initial_guess = np.concatenate([np.array([-2.1968994 ,  -4.123193  ,  anp.exp(-2.57692626)]),np.ones(3),np.array([0.01937842, 0.        , -11.97496092])])

savepath = None
init_util = None
iter_tol = 1e-5
max_iter = 50

#Code for loading pre-solution
# with open(savepath,'rb') as f:
#     preload = pickle.load(f)
# init_util = preload['util_sol']

2.5 Run Code#

You are now ready to run the function uncertain_expansion. You do not need to change anything in the following code.

ModelSol = uncertain_expansion(control_variables, state_variables, shock_variables, variables, variables_tp1,
                            kappa, growth, state_equations, initial_guess, parameter_names,
                            args, approach = '1', init_util = init_util, iter_tol = iter_tol, max_iter = max_iter,
                            savepath=savepath)
Hide code cell output
[Z_tp1, Y_tp1, log_gk_tp1]
[-sqrt(epsilon)*(W1_tp1*sigma_k1 + W2_tp1*sigma_k2 + W3_tp1*sigma_k3)*exp(0.5*Y_t) - epsilon*(Z_t*beta_k - alpha_k + phi_1*log(imk_t*phi_2 + 1.0) - 0.5*q_t**2*(sigma_k1**2 + sigma_k2**2 + sigma_k3**2)*exp(Y_t)) + log_gk_tp1, Z_t*beta_z*epsilon - Z_t + Z_tp1 - sqrt(epsilon)*(W1_tp1*sigma_z1 + W2_tp1*sigma_z2 + W3_tp1*sigma_z3)*exp(0.5*Y_t), -Y_t + Y_tp1 + beta_2*epsilon*(-mu_2*exp(-Y_t) + 1) - sqrt(epsilon)*(W1_tp1*sigma_y1 + W2_tp1*sigma_y2 + W3_tp1*sigma_y3)*exp(-0.5*Y_t) + 0.5*epsilon*q_t**2*(sigma_y1**2 + sigma_y2**2 + sigma_y3**2)*exp(-Y_t)]
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968993672636477
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154922961948
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045179079975
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154922961948
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123192938559636
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154925317954
  Equation 2: 8.34543252281605E-8
  Equation 3: 0.000581045193629781
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154925317954
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727306135664
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 9.19587321845938E-8
  Equation 3: 0.000581033504244238
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338151722814
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0000000149011612
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614286549239
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0000000149011612
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941719258452
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0000000149011612
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581047494947445
  Equation 4: -0.00650614247126997
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145155298725040
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842028876096
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154926661940
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184092771
  Equation 4: -0.00650614262019363
  Equation 5: -0.0508941711677371
  Equation 6: -0.0000145154926661940
  Equation 7: 0.0145338156371238
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 1.4901161193880158e-08
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338151993512
  Equation 8: 2.08616256714322E-10
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.974960741559176

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941625348600
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 8.87586832504228E-9
Variable Dictionary:
  vmk_t: -2.190969671823048
  log_cmk_t: -4.126677382067626
  imk_t: 0.07606369322178491
  m0_t: 0.6061091869275164
  m1_t: 0.00027091309285176557
  mg_t: 1.0
  log_gk_t: 0.004853376275452266
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 3.34013856026841E-9
  Equation 2: 0.00000608440719052084
  Equation 3: -0.00000187658854466921
  Equation 4: -0.00000563217594579807
  Equation 5: -0.0000137841625971271
  Equation 6: -3.34013856026841E-9
  Equation 7: 1.20480242449261E-9
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896408239047855
  log_cmk_t: -4.126671003857404
  imk_t: 0.07606349139493146
  m0_t: 0.605767370898716
  m1_t: 1.0526260585288875e-08
  mg_t: 1.0
  log_gk_t: 0.004853343692950123
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -8.07718909118238E-13
  Equation 2: -4.49280905812088E-8
  Equation 3: 1.31242751666427E-8
  Equation 4: -3.57598943685755E-9
  Equation 5: -5.35580195965482E-10
  Equation 6: 8.07718909118238E-13
  Equation 7: -9.07102951780425E-12
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410969301474
  log_cmk_t: -4.126671037648796
  imk_t: 0.07606349266754037
  m0_t: 0.6057671544702979
  m1_t: -1.3428522154266637e-11
  mg_t: 1.0
  log_gk_t: 0.004853343899843996
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -2.72091377206962E-15
  Equation 2: 1.45716327892842E-10
  Equation 3: -4.67853811247920E-11
  Equation 4: -1.22541490843453E-11
  Equation 5: 6.83248383285139E-13
  Equation 6: 2.72091377206962E-15
  Equation 7: 2.94608087925141E-14
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410981754433
  log_cmk_t: -4.126671037516452
  imk_t: 0.07606349266305397
  m0_t: 0.6057671537273439
  m1_t: -1.7210410799997146e-14
  mg_t: 1.0
  log_gk_t: 0.00485334389911725
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -5.11743425413158E-17
  Equation 2: 3.28626015289046E-14
  Equation 3: -8.35442826030430E-15
  Equation 4: -1.96734989410530E-14
  Equation 5: 8.75672335323573E-16
  Equation 6: 5.11743425413158E-17
  Equation 7: 7.80625564189563E-18
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410981754433
  log_cmk_t: -4.126671037516452
  imk_t: 0.07606349266305397
  m0_t: 0.6057671537273439
  m1_t: -1.7210410799997146e-14
  mg_t: 1.0
  log_gk_t: 0.00485334389911725
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -5.11743425413158E-17
  Equation 2: 3.28626015289046E-14
  Equation 3: -8.35442826030430E-15
  Equation 4: -1.96734989410530E-14
  Equation 5: 8.75672335323573E-16
  Equation 6: 5.11743425413158E-17
  Equation 7: 7.80625564189563E-18
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968993672636477
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154922961948
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045179079975
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154922961948
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123192938559636
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154925317954
  Equation 2: 8.34543252281605E-8
  Equation 3: 0.000581045193629781
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154925317954
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727306135664
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 9.19587321845938E-8
  Equation 3: 0.000581033504244238
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338151722814
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0000000149011612
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614286549239
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0000000149011612
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941719258452
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0000000149011612
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581047494947445
  Equation 4: -0.00650614247126997
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145155298725040
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842028876096
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154926661940
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184092771
  Equation 4: -0.00650614262019363
  Equation 5: -0.0508941711677371
  Equation 6: -0.0000145154926661940
  Equation 7: 0.0145338156371238
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 1.4901161193880158e-08
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338151993512
  Equation 8: 2.08616256714322E-10
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.974960741559176

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941625348600
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 8.87586832504228E-9
Variable Dictionary:
  vmk_t: -2.190969671823048
  log_cmk_t: -4.126677382067626
  imk_t: 0.07606369322178491
  m0_t: 0.6061091869275164
  m1_t: 0.00027091309285176557
  mg_t: 1.0
  log_gk_t: 0.004853376275452266
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 3.34013856026841E-9
  Equation 2: 0.00000608440719052084
  Equation 3: -0.00000187658854466921
  Equation 4: -0.00000563217594579807
  Equation 5: -0.0000137841625971271
  Equation 6: -3.34013856026841E-9
  Equation 7: 1.20480242449261E-9
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896408239047855
  log_cmk_t: -4.126671003857404
  imk_t: 0.07606349139493146
  m0_t: 0.605767370898716
  m1_t: 1.0526260585288875e-08
  mg_t: 1.0
  log_gk_t: 0.004853343692950123
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -8.07718909118238E-13
  Equation 2: -4.49280905812088E-8
  Equation 3: 1.31242751666427E-8
  Equation 4: -3.57598943685755E-9
  Equation 5: -5.35580195965482E-10
  Equation 6: 8.07718909118238E-13
  Equation 7: -9.07102951780425E-12
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410969301474
  log_cmk_t: -4.126671037648796
  imk_t: 0.07606349266754037
  m0_t: 0.6057671544702979
  m1_t: -1.3428522154266637e-11
  mg_t: 1.0
  log_gk_t: 0.004853343899843996
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -2.72091377206962E-15
  Equation 2: 1.45716327892842E-10
  Equation 3: -4.67853811247920E-11
  Equation 4: -1.22541490843453E-11
  Equation 5: 6.83248383285139E-13
  Equation 6: 2.72091377206962E-15
  Equation 7: 2.94608087925141E-14
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410981754433
  log_cmk_t: -4.126671037516452
  imk_t: 0.07606349266305397
  m0_t: 0.6057671537273439
  m1_t: -1.7210410799997146e-14
  mg_t: 1.0
  log_gk_t: 0.00485334389911725
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -5.11743425413158E-17
  Equation 2: 3.28626015289046E-14
  Equation 3: -8.35442826030430E-15
  Equation 4: -1.96734989410530E-14
  Equation 5: 8.75672335323573E-16
  Equation 6: 5.11743425413158E-17
  Equation 7: 7.80625564189563E-18
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410981754433
  log_cmk_t: -4.126671037516452
  imk_t: 0.07606349266305397
  m0_t: 0.6057671537273439
  m1_t: -1.7210410799997146e-14
  mg_t: 1.0
  log_gk_t: 0.00485334389911725
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -5.11743425413158E-17
  Equation 2: 3.28626015289046E-14
  Equation 3: -8.35442826030430E-15
  Equation 4: -1.96734989410530E-14
  Equation 5: 8.75672335323573E-16
  Equation 6: 5.11743425413158E-17
  Equation 7: 7.80625564189563E-18
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Iteration 1: mu_0 error = 5.75982404e-20
Iteration 1: J1 error = 0.000561672114
Iteration 1: J2 error = 0.000554623791
Iteration 1: error = 0.000561672114
Iteration 2: mu_0 error = 7.79270311e-20
Iteration 2: J1 error = 8.52838789e-08
Iteration 2: J2 error = 7.83537071e-08
Iteration 2: error = 8.52838789e-08

You can also run the model solution for different parameters using code like the one displayed below, which loops over values of \(\gamma\) and \(\lambda\) and saves them to appropriately named outputs:

gamma_values = [1.001, 8.001]
rho_values = [1.001, 1.5]

for gamma_i in gamma_values:
    for llambda_i in rho_values:
        args = change_parameter_value('gamma', parameter_names, args, gamma_i)
        args = change_parameter_value('rho', parameter_names, args, llambda_i)
        output_folder = 'output'
        if not os.path.exists(output_folder):
            os.makedirs(output_folder)
            print(f"Created output folder at: {output_folder}")
        savepath = output_folder+'/single_capital_gamma_{}_rho_{}.pkl'.format(gamma_i, llambda_i)
        uncertain_expansion(control_variables, state_variables, shock_variables, variables, variables_tp1,
                            kappa, growth, state_equations, initial_guess, parameter_names,
                            args, approach = '1', init_util = init_util, iter_tol = iter_tol, max_iter = max_iter,
                            savepath=savepath)
        
Hide code cell output
[Z_tp1, Y_tp1, log_gk_tp1]
[-sqrt(epsilon)*(W1_tp1*sigma_k1 + W2_tp1*sigma_k2 + W3_tp1*sigma_k3)*exp(0.5*Y_t) - epsilon*(Z_t*beta_k - alpha_k + phi_1*log(imk_t*phi_2 + 1.0) - 0.5*q_t**2*(sigma_k1**2 + sigma_k2**2 + sigma_k3**2)*exp(Y_t)) + log_gk_tp1, Z_t*beta_z*epsilon - Z_t + Z_tp1 - sqrt(epsilon)*(W1_tp1*sigma_z1 + W2_tp1*sigma_z2 + W3_tp1*sigma_z3)*exp(0.5*Y_t), -Y_t + Y_tp1 + beta_2*epsilon*(-mu_2*exp(-Y_t) + 1) - sqrt(epsilon)*(W1_tp1*sigma_y1 + W2_tp1*sigma_y2 + W3_tp1*sigma_y3)*exp(-0.5*Y_t) + 0.5*epsilon*q_t**2*(sigma_y1**2 + sigma_y2**2 + sigma_y3**2)*exp(-Y_t)]
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968993672636477
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154922961948
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045179079975
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154922961948
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123192938559636
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154925317954
  Equation 2: 8.34543252281605E-8
  Equation 3: 0.000581045193629781
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154925317954
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727306135664
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 9.19587321845938E-8
  Equation 3: 0.000581033504244238
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338151722814
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0000000149011612
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614286549239
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0000000149011612
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941719258452
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0000000149011612
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581047494947445
  Equation 4: -0.00650614247126997
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145155298725040
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842028876096
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154926661940
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184092771
  Equation 4: -0.00650614262019363
  Equation 5: -0.0508941711677371
  Equation 6: -0.0000145154926661940
  Equation 7: 0.0145338156371238
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 1.4901161193880158e-08
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338151993512
  Equation 8: 2.08616256714322E-10
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.974960741559176

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941625348600
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 8.87586832504228E-9
Variable Dictionary:
  vmk_t: -2.190969671823048
  log_cmk_t: -4.126677382067626
  imk_t: 0.07606369322178491
  m0_t: 0.6061091869275164
  m1_t: 0.00027091309285176557
  mg_t: 1.0
  log_gk_t: 0.004853376275452266
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 3.34013856026841E-9
  Equation 2: 0.00000608440719052084
  Equation 3: -0.00000187658854466921
  Equation 4: -0.00000563217594579807
  Equation 5: -0.0000137841625971271
  Equation 6: -3.34013856026841E-9
  Equation 7: 1.20480242449261E-9
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896408239047855
  log_cmk_t: -4.126671003857404
  imk_t: 0.07606349139493146
  m0_t: 0.605767370898716
  m1_t: 1.0526260585288875e-08
  mg_t: 1.0
  log_gk_t: 0.004853343692950123
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -8.07718909118238E-13
  Equation 2: -4.49280905812088E-8
  Equation 3: 1.31242751666427E-8
  Equation 4: -3.57598943685755E-9
  Equation 5: -5.35580195965482E-10
  Equation 6: 8.07718909118238E-13
  Equation 7: -9.07102951780425E-12
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410969301474
  log_cmk_t: -4.126671037648796
  imk_t: 0.07606349266754037
  m0_t: 0.6057671544702979
  m1_t: -1.3428522154266637e-11
  mg_t: 1.0
  log_gk_t: 0.004853343899843996
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -2.72091377206962E-15
  Equation 2: 1.45716327892842E-10
  Equation 3: -4.67853811247920E-11
  Equation 4: -1.22541490843453E-11
  Equation 5: 6.83248383285139E-13
  Equation 6: 2.72091377206962E-15
  Equation 7: 2.94608087925141E-14
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410981754433
  log_cmk_t: -4.126671037516452
  imk_t: 0.07606349266305397
  m0_t: 0.6057671537273439
  m1_t: -1.7210410799997146e-14
  mg_t: 1.0
  log_gk_t: 0.00485334389911725
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -5.11743425413158E-17
  Equation 2: 3.28626015289046E-14
  Equation 3: -8.35442826030430E-15
  Equation 4: -1.96734989410530E-14
  Equation 5: 8.75672335323573E-16
  Equation 6: 5.11743425413158E-17
  Equation 7: 7.80625564189563E-18
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410981754433
  log_cmk_t: -4.126671037516452
  imk_t: 0.07606349266305397
  m0_t: 0.6057671537273439
  m1_t: -1.7210410799997146e-14
  mg_t: 1.0
  log_gk_t: 0.00485334389911725
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -5.11743425413158E-17
  Equation 2: 3.28626015289046E-14
  Equation 3: -8.35442826030430E-15
  Equation 4: -1.96734989410530E-14
  Equation 5: 8.75672335323573E-16
  Equation 6: 5.11743425413158E-17
  Equation 7: 7.80625564189563E-18
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968993672636477
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154922961948
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045179079975
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154922961948
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123192938559636
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154925317954
  Equation 2: 8.34543252281605E-8
  Equation 3: 0.000581045193629781
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154925317954
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727306135664
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 9.19587321845938E-8
  Equation 3: 0.000581033504244238
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338151722814
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0000000149011612
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614286549239
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0000000149011612
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941719258452
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0000000149011612
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581047494947445
  Equation 4: -0.00650614247126997
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145155298725040
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842028876096
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154926661940
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184092771
  Equation 4: -0.00650614262019363
  Equation 5: -0.0508941711677371
  Equation 6: -0.0000145154926661940
  Equation 7: 0.0145338156371238
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 1.4901161193880158e-08
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338151993512
  Equation 8: 2.08616256714322E-10
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.974960741559176

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941625348600
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 8.87586832504228E-9
Variable Dictionary:
  vmk_t: -2.190969671823048
  log_cmk_t: -4.126677382067626
  imk_t: 0.07606369322178491
  m0_t: 0.6061091869275164
  m1_t: 0.00027091309285176557
  mg_t: 1.0
  log_gk_t: 0.004853376275452266
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 3.34013856026841E-9
  Equation 2: 0.00000608440719052084
  Equation 3: -0.00000187658854466921
  Equation 4: -0.00000563217594579807
  Equation 5: -0.0000137841625971271
  Equation 6: -3.34013856026841E-9
  Equation 7: 1.20480242449261E-9
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896408239047855
  log_cmk_t: -4.126671003857404
  imk_t: 0.07606349139493146
  m0_t: 0.605767370898716
  m1_t: 1.0526260585288875e-08
  mg_t: 1.0
  log_gk_t: 0.004853343692950123
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -8.07718909118238E-13
  Equation 2: -4.49280905812088E-8
  Equation 3: 1.31242751666427E-8
  Equation 4: -3.57598943685755E-9
  Equation 5: -5.35580195965482E-10
  Equation 6: 8.07718909118238E-13
  Equation 7: -9.07102951780425E-12
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410969301474
  log_cmk_t: -4.126671037648796
  imk_t: 0.07606349266754037
  m0_t: 0.6057671544702979
  m1_t: -1.3428522154266637e-11
  mg_t: 1.0
  log_gk_t: 0.004853343899843996
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -2.72091377206962E-15
  Equation 2: 1.45716327892842E-10
  Equation 3: -4.67853811247920E-11
  Equation 4: -1.22541490843453E-11
  Equation 5: 6.83248383285139E-13
  Equation 6: 2.72091377206962E-15
  Equation 7: 2.94608087925141E-14
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410981754433
  log_cmk_t: -4.126671037516452
  imk_t: 0.07606349266305397
  m0_t: 0.6057671537273439
  m1_t: -1.7210410799997146e-14
  mg_t: 1.0
  log_gk_t: 0.00485334389911725
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -5.11743425413158E-17
  Equation 2: 3.28626015289046E-14
  Equation 3: -8.35442826030430E-15
  Equation 4: -1.96734989410530E-14
  Equation 5: 8.75672335323573E-16
  Equation 6: 5.11743425413158E-17
  Equation 7: 7.80625564189563E-18
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410981754433
  log_cmk_t: -4.126671037516452
  imk_t: 0.07606349266305397
  m0_t: 0.6057671537273439
  m1_t: -1.7210410799997146e-14
  mg_t: 1.0
  log_gk_t: 0.00485334389911725
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -5.11743425413158E-17
  Equation 2: 3.28626015289046E-14
  Equation 3: -8.35442826030430E-15
  Equation 4: -1.96734989410530E-14
  Equation 5: 8.75672335323573E-16
  Equation 6: 5.11743425413158E-17
  Equation 7: 7.80625564189563E-18
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Iteration 1: mu_0 error = 5.75982404e-20
Iteration 1: J1 error = 0.000561672114
Iteration 1: J2 error = 0.000554623791
Iteration 1: error = 0.000561672114
Iteration 2: mu_0 error = 7.79270311e-20
Iteration 2: J1 error = 8.52838789e-08
Iteration 2: J2 error = 7.83537071e-08
Iteration 2: error = 8.52838789e-08
[Z_tp1, Y_tp1, log_gk_tp1]
[-sqrt(epsilon)*(W1_tp1*sigma_k1 + W2_tp1*sigma_k2 + W3_tp1*sigma_k3)*exp(0.5*Y_t) - epsilon*(Z_t*beta_k - alpha_k + phi_1*log(imk_t*phi_2 + 1.0) - 0.5*q_t**2*(sigma_k1**2 + sigma_k2**2 + sigma_k3**2)*exp(Y_t)) + log_gk_tp1, Z_t*beta_z*epsilon - Z_t + Z_tp1 - sqrt(epsilon)*(W1_tp1*sigma_z1 + W2_tp1*sigma_z2 + W3_tp1*sigma_z3)*exp(0.5*Y_t), -Y_t + Y_tp1 + beta_2*epsilon*(-mu_2*exp(-Y_t) + 1) - sqrt(epsilon)*(W1_tp1*sigma_y1 + W2_tp1*sigma_y2 + W3_tp1*sigma_y3)*exp(-0.5*Y_t) + 0.5*epsilon*q_t**2*(sigma_y1**2 + sigma_y2**2 + sigma_y3**2)*exp(-Y_t)]
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968993672636477
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358308937536
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402750360566
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358308937536
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123192938559636
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358339741041
  Equation 2: 8.34543252281605E-8
  Equation 3: -0.250402731337517
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358339741041
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727306135664
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 9.19587321845938E-8
  Equation 3: -0.250402772870156
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338151722814
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0000000149011612
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667619978970
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0000000149011612
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276348856458
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0000000149011612
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402741459475
  Equation 4: -0.0160667614640710
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358337698094
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842028876096
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358333908130
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743770222
  Equation 4: -0.0160667617533380
  Equation 5: -0.0600276341268781
  Equation 6: -0.00557358333908130
  Equation 7: 0.0145338156371238
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 1.4901161193880158e-08
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338151993512
  Equation 8: 2.08616256714322E-10
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.974960741559176

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276254416350
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 8.87586832504228E-9
Variable Dictionary:
  vmk_t: -2.4990412620769447
  log_cmk_t: -3.8188399396908546
  imk_t: 0.07107896538859211
  m0_t: 0.6708625092622533
  m1_t: 0.11979133410667753
  mg_t: 1.0000000000000009
  log_gk_t: 0.004078415544384683
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -0.000301532242793315
  Equation 2: 0.0386458943704886
  Equation 3: -0.0700506740870134
  Equation 4: -0.00243311177293890
  Equation 5: -0.00632609272245618
  Equation 6: 0.000301532242793311
  Equation 7: 0.00000954912477009462
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.5931567574112755
  log_cmk_t: -3.7289026398205487
  imk_t: 0.06875688288000965
  m0_t: 0.548219847461722
  m1_t: -0.02307775158220332
  mg_t: 0.9999999999999996
  log_gk_t: 0.003704197375870328
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -0.0000631230706961651
  Equation 2: 0.0242757003594813
  Equation 3: -0.0273500781652956
  Equation 4: -0.0000658967204150204
  Equation 5: 0.00121462877264170
  Equation 6: 0.0000631230706961668
  Equation 7: 0.00000762066205286290
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.638449426639722
  log_cmk_t: -3.6719560781959393
  imk_t: 0.06698705419426898
  m0_t: 0.5238878109405951
  m1_t: -0.014533835038480864
  mg_t: 0.9999999999999991
  log_gk_t: 0.003413314651906058
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 0.0000116178985622405
  Equation 2: 0.00844161572937896
  Equation 3: -0.00394579816985263
  Equation 4: 0.000455193416019484
  Equation 5: 0.000762942441250680
  Equation 6: -0.0000116178985622370
  Equation 7: 0.00000349570250840351
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6434607937665993
  log_cmk_t: -3.6648097637088544
  imk_t: 0.06662582872674504
  m0_t: 0.541038981121622
  m1_t: -0.0013164503468426191
  mg_t: 0.9999999999999993
  log_gk_t: 0.0033515161371127622
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 0.00000621795361824447
  Equation 2: 0.00136260774340347
  Equation 3: -0.000298049568510650
  Equation 4: 0.000160809857545657
  Equation 5: 0.0000690675012368642
  Equation 6: -0.00000621795361824187
  Equation 7: 5.49742981579334E-7
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6427858769844788
  log_cmk_t: -3.663844175070631
  imk_t: 0.06656774129621157
  m0_t: 0.5481768298579396
  m1_t: 0.00011164568845901794
  mg_t: 0.9999999999999996
  log_gk_t: 0.00334151534734168
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 0.00000184305788123503
  Equation 2: 0.0000594400760061120
  Equation 3: 0.000144296664201377
  Equation 4: 0.0000342938686621053
  Equation 5: -0.00000585695644572449
  Equation 6: -0.00000184305788123330
  Equation 7: 2.31843045443193E-8
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.642293766679322
  log_cmk_t: -3.6640636968089506
  imk_t: 0.06657255574351265
  m0_t: 0.5493062604246624
  m1_t: 7.64708886791394e-06
  mg_t: 0.9999999999999997
  log_gk_t: 0.0033422862639455736
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 7.46372257013662E-7
  Equation 2: 0.0000277636445140672
  Equation 3: 0.0000518888867312994
  Equation 4: 0.0000136351400746582
  Equation 5: -4.01170693472762E-7
  Equation 6: -7.46372257011928E-7
  Equation 7: 8.74118862188855E-9
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6420121515313357
  log_cmk_t: -3.6641583544202163
  imk_t: 0.06657432656093322
  m0_t: 0.5499712673821173
  m1_t: -3.1292639966093615e-06
  mg_t: 0.9999999999999999
  log_gk_t: 0.003342567081851625
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 1.03154115142085E-7
  Equation 2: 0.00000220689972829646
  Equation 3: 0.00000858569987771673
  Equation 4: 0.00000151851223440837
  Equation 5: 1.64163410802474E-7
  Equation 6: -1.03154115141217E-7
  Equation 7: 6.98362936490254E-10
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.641954245079993
  log_cmk_t: -3.664181927080247
  imk_t: 0.06657485733246968
  m0_t: 0.5500820857994922
  m1_t: -1.111886782868601e-06
  mg_t: 1.0
  log_gk_t: 0.0033426527571405983
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -2.37681131477763E-8
  Equation 2: -6.53054561983168E-7
  Equation 3: -0.00000185359081250613
  Equation 4: -5.11343997488395E-7
  Equation 5: 5.83304151165340E-8
  Equation 6: 2.37681131477763E-8
  Equation 7: -2.06777919439793E-10
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.641964570247612
  log_cmk_t: -3.664177927424757
  imk_t: 0.066574770978437
  m0_t: 0.5500568860059079
  m1_t: -1.9422963398257696e-07
  mg_t: 1.0
  log_gk_t: 0.003342638870283248
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -8.68045460164502E-10
  Equation 2: -2.32881025574727E-8
  Equation 3: -6.83356736475016E-8
  Equation 4: -5.12985432448571E-8
  Equation 5: 1.01894310930291E-8
  Equation 6: 8.68045460164502E-10
  Equation 7: -7.42287698321520E-12
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6419649683024446
  log_cmk_t: -3.6641777715933546
  imk_t: 0.06657476759180911
  m0_t: 0.5500546124929157
  m1_t: -1.9740150403183506e-08
  mg_t: 1.0
  log_gk_t: 0.0033426383253947764
  Z_t: -5.123497510187612e-41
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 1.34565882742299E-11
  Equation 2: 3.83401310699583E-10
  Equation 3: 1.03601990875113E-9
  Equation 4: -9.98819836908749E-9
  Equation 5: 1.03558297045201E-9
  Equation 6: -1.34565882742299E-11
  Equation 7: 1.21114056284011E-13
  Equation 8: -7.17289651426266E-43
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6419649633748024
  log_cmk_t: -3.664177773441421
  imk_t: 0.06657476763076715
  m0_t: 0.5500542311196926
  m1_t: -2.6035421405655454e-09
  mg_t: 1.0
  log_gk_t: 0.003342638331647379
  Z_t: 1.5886845991479667e-39
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 2.46759730704316E-12
  Equation 2: 5.56350521208060E-11
  Equation 3: 2.05184508272893E-10
  Equation 4: -3.08540203108887E-9
  Equation 5: 1.36583756896872E-10
  Equation 6: -2.46759730704316E-12
  Equation 7: 1.88174129056584E-14
  Equation 8: 2.22415843880715E-41
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6419649633748024
  log_cmk_t: -3.664177773441421
  imk_t: 0.06657476763076715
  m0_t: 0.5500542311196926
  m1_t: -2.6035421405655454e-09
  mg_t: 1.0
  log_gk_t: 0.003342638331647379
  Z_t: 1.5886845991479667e-39
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 2.46759730704316E-12
  Equation 2: 5.56350521208060E-11
  Equation 3: 2.05184508272893E-10
  Equation 4: -3.08540203108887E-9
  Equation 5: 1.36583756896872E-10
  Equation 6: -2.46759730704316E-12
  Equation 7: 1.88174129056584E-14
  Equation 8: 2.22415843880715E-41
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968993672636477
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358308937536
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402750360566
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358308937536
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123192938559636
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358339741041
  Equation 2: 8.34543252281605E-8
  Equation 3: -0.250402731337517
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358339741041
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727306135664
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 9.19587321845938E-8
  Equation 3: -0.250402772870156
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338151722814
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0000000149011612
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667619978970
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0000000149011612
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276348856458
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0000000149011612
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402741459475
  Equation 4: -0.0160667614640710
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358337698094
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842028876096
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358333908130
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743770222
  Equation 4: -0.0160667617533380
  Equation 5: -0.0600276341268781
  Equation 6: -0.00557358333908130
  Equation 7: 0.0145338156371238
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 1.4901161193880158e-08
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338151993512
  Equation 8: 2.08616256714322E-10
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.974960741559176

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276254416350
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 8.87586832504228E-9
Variable Dictionary:
  vmk_t: -2.4990412620769447
  log_cmk_t: -3.8188399396908546
  imk_t: 0.07107896538859211
  m0_t: 0.6708625092622533
  m1_t: 0.11979133410667753
  mg_t: 1.0000000000000009
  log_gk_t: 0.004078415544384683
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -0.000301532242793315
  Equation 2: 0.0386458943704886
  Equation 3: -0.0700506740870134
  Equation 4: -0.00243311177293890
  Equation 5: -0.00632609272245618
  Equation 6: 0.000301532242793311
  Equation 7: 0.00000954912477009462
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.5931567574112755
  log_cmk_t: -3.7289026398205487
  imk_t: 0.06875688288000965
  m0_t: 0.548219847461722
  m1_t: -0.02307775158220332
  mg_t: 0.9999999999999996
  log_gk_t: 0.003704197375870328
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -0.0000631230706961651
  Equation 2: 0.0242757003594813
  Equation 3: -0.0273500781652956
  Equation 4: -0.0000658967204150204
  Equation 5: 0.00121462877264170
  Equation 6: 0.0000631230706961668
  Equation 7: 0.00000762066205286290
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.638449426639722
  log_cmk_t: -3.6719560781959393
  imk_t: 0.06698705419426898
  m0_t: 0.5238878109405951
  m1_t: -0.014533835038480864
  mg_t: 0.9999999999999991
  log_gk_t: 0.003413314651906058
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 0.0000116178985622405
  Equation 2: 0.00844161572937896
  Equation 3: -0.00394579816985263
  Equation 4: 0.000455193416019484
  Equation 5: 0.000762942441250680
  Equation 6: -0.0000116178985622370
  Equation 7: 0.00000349570250840351
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6434607937665993
  log_cmk_t: -3.6648097637088544
  imk_t: 0.06662582872674504
  m0_t: 0.541038981121622
  m1_t: -0.0013164503468426191
  mg_t: 0.9999999999999993
  log_gk_t: 0.0033515161371127622
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 0.00000621795361824447
  Equation 2: 0.00136260774340347
  Equation 3: -0.000298049568510650
  Equation 4: 0.000160809857545657
  Equation 5: 0.0000690675012368642
  Equation 6: -0.00000621795361824187
  Equation 7: 5.49742981579334E-7
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6427858769844788
  log_cmk_t: -3.663844175070631
  imk_t: 0.06656774129621157
  m0_t: 0.5481768298579396
  m1_t: 0.00011164568845901794
  mg_t: 0.9999999999999996
  log_gk_t: 0.00334151534734168
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 0.00000184305788123503
  Equation 2: 0.0000594400760061120
  Equation 3: 0.000144296664201377
  Equation 4: 0.0000342938686621053
  Equation 5: -0.00000585695644572449
  Equation 6: -0.00000184305788123330
  Equation 7: 2.31843045443193E-8
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.642293766679322
  log_cmk_t: -3.6640636968089506
  imk_t: 0.06657255574351265
  m0_t: 0.5493062604246624
  m1_t: 7.64708886791394e-06
  mg_t: 0.9999999999999997
  log_gk_t: 0.0033422862639455736
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 7.46372257013662E-7
  Equation 2: 0.0000277636445140672
  Equation 3: 0.0000518888867312994
  Equation 4: 0.0000136351400746582
  Equation 5: -4.01170693472762E-7
  Equation 6: -7.46372257011928E-7
  Equation 7: 8.74118862188855E-9
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6420121515313357
  log_cmk_t: -3.6641583544202163
  imk_t: 0.06657432656093322
  m0_t: 0.5499712673821173
  m1_t: -3.1292639966093615e-06
  mg_t: 0.9999999999999999
  log_gk_t: 0.003342567081851625
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 1.03154115142085E-7
  Equation 2: 0.00000220689972829646
  Equation 3: 0.00000858569987771673
  Equation 4: 0.00000151851223440837
  Equation 5: 1.64163410802474E-7
  Equation 6: -1.03154115141217E-7
  Equation 7: 6.98362936490254E-10
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.641954245079993
  log_cmk_t: -3.664181927080247
  imk_t: 0.06657485733246968
  m0_t: 0.5500820857994922
  m1_t: -1.111886782868601e-06
  mg_t: 1.0
  log_gk_t: 0.0033426527571405983
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -2.37681131477763E-8
  Equation 2: -6.53054561983168E-7
  Equation 3: -0.00000185359081250613
  Equation 4: -5.11343997488395E-7
  Equation 5: 5.83304151165340E-8
  Equation 6: 2.37681131477763E-8
  Equation 7: -2.06777919439793E-10
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.641964570247612
  log_cmk_t: -3.664177927424757
  imk_t: 0.066574770978437
  m0_t: 0.5500568860059079
  m1_t: -1.9422963398257696e-07
  mg_t: 1.0
  log_gk_t: 0.003342638870283248
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -8.68045460164502E-10
  Equation 2: -2.32881025574727E-8
  Equation 3: -6.83356736475016E-8
  Equation 4: -5.12985432448571E-8
  Equation 5: 1.01894310930291E-8
  Equation 6: 8.68045460164502E-10
  Equation 7: -7.42287698321520E-12
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6419649683024446
  log_cmk_t: -3.6641777715933546
  imk_t: 0.06657476759180911
  m0_t: 0.5500546124929157
  m1_t: -1.9740150403183506e-08
  mg_t: 1.0
  log_gk_t: 0.0033426383253947764
  Z_t: -5.123497510187612e-41
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 1.34565882742299E-11
  Equation 2: 3.83401310699583E-10
  Equation 3: 1.03601990875113E-9
  Equation 4: -9.98819836908749E-9
  Equation 5: 1.03558297045201E-9
  Equation 6: -1.34565882742299E-11
  Equation 7: 1.21114056284011E-13
  Equation 8: -7.17289651426266E-43
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6419649633748024
  log_cmk_t: -3.664177773441421
  imk_t: 0.06657476763076715
  m0_t: 0.5500542311196926
  m1_t: -2.6035421405655454e-09
  mg_t: 1.0
  log_gk_t: 0.003342638331647379
  Z_t: 1.5886845991479667e-39
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 2.46759730704316E-12
  Equation 2: 5.56350521208060E-11
  Equation 3: 2.05184508272893E-10
  Equation 4: -3.08540203108887E-9
  Equation 5: 1.36583756896872E-10
  Equation 6: -2.46759730704316E-12
  Equation 7: 1.88174129056584E-14
  Equation 8: 2.22415843880715E-41
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6419649633748024
  log_cmk_t: -3.664177773441421
  imk_t: 0.06657476763076715
  m0_t: 0.5500542311196926
  m1_t: -2.6035421405655454e-09
  mg_t: 1.0
  log_gk_t: 0.003342638331647379
  Z_t: 1.5886845991479667e-39
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 2.46759730704316E-12
  Equation 2: 5.56350521208060E-11
  Equation 3: 2.05184508272893E-10
  Equation 4: -3.08540203108887E-9
  Equation 5: 1.36583756896872E-10
  Equation 6: -2.46759730704316E-12
  Equation 7: 1.88174129056584E-14
  Equation 8: 2.22415843880715E-41
  Equation 9: 1.38777878078145E-17
Iteration 1: mu_0 error = 6.93747089e-16
Iteration 1: J1 error = 0.181631325
Iteration 1: J2 error = 0.172195867
Iteration 1: error = 0.181631325
Iteration 2: mu_0 error = 5.26549561e-17
Iteration 2: J1 error = 0.0224542295
Iteration 2: J2 error = 0.0248510469
Iteration 2: error = 0.0248510469
Iteration 3: mu_0 error = 3.94039727e-18
Iteration 3: J1 error = 0.00169963076
Iteration 3: J2 error = 0.00125459299
Iteration 3: error = 0.00169963076
Iteration 4: mu_0 error = 2.77826807e-19
Iteration 4: J1 error = 0.000126707777
Iteration 4: J2 error = 0.000167554585
Iteration 4: error = 0.000167554585
Iteration 5: mu_0 error = 1.01643954e-19
Iteration 5: J1 error = 8.58312988e-06
Iteration 5: J2 error = 0.000133254362
Iteration 5: error = 0.000133254362
Iteration 6: mu_0 error = 1.01643954e-20
Iteration 6: J1 error = 1.92186795e-07
Iteration 6: J2 error = 6.36410481e-05
Iteration 6: error = 6.36410481e-05
Iteration 7: mu_0 error = 0
Iteration 7: J1 error = 1.88907326e-07
Iteration 7: J2 error = 2.85413492e-05
Iteration 7: error = 2.85413492e-05
Iteration 8: mu_0 error = 8.47032947e-20
Iteration 8: J1 error = 1.04464107e-07
Iteration 8: J2 error = 1.26670543e-05
Iteration 8: error = 1.26670543e-05
Iteration 9: mu_0 error = 6.77626358e-20
Iteration 9: J1 error = 4.78420567e-08
Iteration 9: J2 error = 5.61174198e-06
Iteration 9: error = 5.61174198e-06
[Z_tp1, Y_tp1, log_gk_tp1]
[-sqrt(epsilon)*(W1_tp1*sigma_k1 + W2_tp1*sigma_k2 + W3_tp1*sigma_k3)*exp(0.5*Y_t) - epsilon*(Z_t*beta_k - alpha_k + phi_1*log(imk_t*phi_2 + 1.0) - 0.5*q_t**2*(sigma_k1**2 + sigma_k2**2 + sigma_k3**2)*exp(Y_t)) + log_gk_tp1, Z_t*beta_z*epsilon - Z_t + Z_tp1 - sqrt(epsilon)*(W1_tp1*sigma_z1 + W2_tp1*sigma_z2 + W3_tp1*sigma_z3)*exp(0.5*Y_t), -Y_t + Y_tp1 + beta_2*epsilon*(-mu_2*exp(-Y_t) + 1) - sqrt(epsilon)*(W1_tp1*sigma_y1 + W2_tp1*sigma_y2 + W3_tp1*sigma_y3)*exp(-0.5*Y_t) + 0.5*epsilon*q_t**2*(sigma_y1**2 + sigma_y2**2 + sigma_y3**2)*exp(-Y_t)]
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968993672636477
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154922961948
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045179079975
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154922961948
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123192938559636
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154925317954
  Equation 2: 8.34543252281605E-8
  Equation 3: 0.000581045193629781
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154925317954
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727306135664
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 9.19587321845938E-8
  Equation 3: 0.000581033504244238
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338151722814
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0000000149011612
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614286549239
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0000000149011612
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941719258452
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0000000149011612
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581047494947445
  Equation 4: -0.00650614247126997
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145155298725040
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842028876096
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154926661940
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184092771
  Equation 4: -0.00650614262019363
  Equation 5: -0.0508941711677371
  Equation 6: -0.0000145154926661940
  Equation 7: 0.0145338156371238
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 1.4901161193880158e-08
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338151993512
  Equation 8: 2.08616256714322E-10
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.974960741559176

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941625348600
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 8.87586832504228E-9
Variable Dictionary:
  vmk_t: -2.190969671823048
  log_cmk_t: -4.126677382067626
  imk_t: 0.07606369322178491
  m0_t: 0.6061091869275164
  m1_t: 0.00027091309285176557
  mg_t: 1.0
  log_gk_t: 0.004853376275452266
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 3.34013856026841E-9
  Equation 2: 0.00000608440719052084
  Equation 3: -0.00000187658854466921
  Equation 4: -0.00000563217594579807
  Equation 5: -0.0000137841625971271
  Equation 6: -3.34013856026841E-9
  Equation 7: 1.20480242449261E-9
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896408239047855
  log_cmk_t: -4.126671003857404
  imk_t: 0.07606349139493146
  m0_t: 0.605767370898716
  m1_t: 1.0526260585288875e-08
  mg_t: 1.0
  log_gk_t: 0.004853343692950123
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -8.07718909118238E-13
  Equation 2: -4.49280905812088E-8
  Equation 3: 1.31242751666427E-8
  Equation 4: -3.57598943685755E-9
  Equation 5: -5.35580195965482E-10
  Equation 6: 8.07718909118238E-13
  Equation 7: -9.07102951780425E-12
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410969301474
  log_cmk_t: -4.126671037648796
  imk_t: 0.07606349266754037
  m0_t: 0.6057671544702979
  m1_t: -1.3428522154266637e-11
  mg_t: 1.0
  log_gk_t: 0.004853343899843996
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -2.72091377206962E-15
  Equation 2: 1.45716327892842E-10
  Equation 3: -4.67853811247920E-11
  Equation 4: -1.22541490843453E-11
  Equation 5: 6.83248383285139E-13
  Equation 6: 2.72091377206962E-15
  Equation 7: 2.94608087925141E-14
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410981754433
  log_cmk_t: -4.126671037516452
  imk_t: 0.07606349266305397
  m0_t: 0.6057671537273439
  m1_t: -1.7210410799997146e-14
  mg_t: 1.0
  log_gk_t: 0.00485334389911725
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -5.11743425413158E-17
  Equation 2: 3.28626015289046E-14
  Equation 3: -8.35442826030430E-15
  Equation 4: -1.96734989410530E-14
  Equation 5: 8.75672335323573E-16
  Equation 6: 5.11743425413158E-17
  Equation 7: 7.80625564189563E-18
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410981754433
  log_cmk_t: -4.126671037516452
  imk_t: 0.07606349266305397
  m0_t: 0.6057671537273439
  m1_t: -1.7210410799997146e-14
  mg_t: 1.0
  log_gk_t: 0.00485334389911725
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -5.11743425413158E-17
  Equation 2: 3.28626015289046E-14
  Equation 3: -8.35442826030430E-15
  Equation 4: -1.96734989410530E-14
  Equation 5: 8.75672335323573E-16
  Equation 6: 5.11743425413158E-17
  Equation 7: 7.80625564189563E-18
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968993672636477
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154922961948
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045179079975
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154922961948
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123192938559636
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154925317954
  Equation 2: 8.34543252281605E-8
  Equation 3: 0.000581045193629781
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154925317954
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727306135664
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 9.19587321845938E-8
  Equation 3: 0.000581033504244238
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338151722814
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0000000149011612
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614286549239
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0000000149011612
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941719258452
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0000000149011612
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581047494947445
  Equation 4: -0.00650614247126997
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145155298725040
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842028876096
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154926661940
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184092771
  Equation 4: -0.00650614262019363
  Equation 5: -0.0508941711677371
  Equation 6: -0.0000145154926661940
  Equation 7: 0.0145338156371238
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 1.4901161193880158e-08
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941711674630
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338151993512
  Equation 8: 2.08616256714322E-10
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.974960741559176

Substituted Equations:
  Equation 1: 0.0000145154923780911
  Equation 2: 2.20139613205106E-8
  Equation 3: 0.000581045184137569
  Equation 4: -0.00650614261990664
  Equation 5: -0.0508941625348600
  Equation 6: -0.0000145154923780911
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 8.87586832504228E-9
Variable Dictionary:
  vmk_t: -2.190969671823048
  log_cmk_t: -4.126677382067626
  imk_t: 0.07606369322178491
  m0_t: 0.6061091869275164
  m1_t: 0.00027091309285176557
  mg_t: 1.0
  log_gk_t: 0.004853376275452266
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 3.34013856026841E-9
  Equation 2: 0.00000608440719052084
  Equation 3: -0.00000187658854466921
  Equation 4: -0.00000563217594579807
  Equation 5: -0.0000137841625971271
  Equation 6: -3.34013856026841E-9
  Equation 7: 1.20480242449261E-9
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896408239047855
  log_cmk_t: -4.126671003857404
  imk_t: 0.07606349139493146
  m0_t: 0.605767370898716
  m1_t: 1.0526260585288875e-08
  mg_t: 1.0
  log_gk_t: 0.004853343692950123
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -8.07718909118238E-13
  Equation 2: -4.49280905812088E-8
  Equation 3: 1.31242751666427E-8
  Equation 4: -3.57598943685755E-9
  Equation 5: -5.35580195965482E-10
  Equation 6: 8.07718909118238E-13
  Equation 7: -9.07102951780425E-12
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410969301474
  log_cmk_t: -4.126671037648796
  imk_t: 0.07606349266754037
  m0_t: 0.6057671544702979
  m1_t: -1.3428522154266637e-11
  mg_t: 1.0
  log_gk_t: 0.004853343899843996
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -2.72091377206962E-15
  Equation 2: 1.45716327892842E-10
  Equation 3: -4.67853811247920E-11
  Equation 4: -1.22541490843453E-11
  Equation 5: 6.83248383285139E-13
  Equation 6: 2.72091377206962E-15
  Equation 7: 2.94608087925141E-14
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410981754433
  log_cmk_t: -4.126671037516452
  imk_t: 0.07606349266305397
  m0_t: 0.6057671537273439
  m1_t: -1.7210410799997146e-14
  mg_t: 1.0
  log_gk_t: 0.00485334389911725
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -5.11743425413158E-17
  Equation 2: 3.28626015289046E-14
  Equation 3: -8.35442826030430E-15
  Equation 4: -1.96734989410530E-14
  Equation 5: 8.75672335323573E-16
  Equation 6: 5.11743425413158E-17
  Equation 7: 7.80625564189563E-18
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1896410981754433
  log_cmk_t: -4.126671037516452
  imk_t: 0.07606349266305397
  m0_t: 0.6057671537273439
  m1_t: -1.7210410799997146e-14
  mg_t: 1.0
  log_gk_t: 0.00485334389911725
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -5.11743425413158E-17
  Equation 2: 3.28626015289046E-14
  Equation 3: -8.35442826030430E-15
  Equation 4: -1.96734989410530E-14
  Equation 5: 8.75672335323573E-16
  Equation 6: 5.11743425413158E-17
  Equation 7: 7.80625564189563E-18
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Iteration 1: mu_0 error = 4.16333634e-17
Iteration 1: J1 error = 0.0203519049
Iteration 1: J2 error = 0.0416920021
Iteration 1: error = 0.0416920021
Iteration 2: mu_0 error = 5.55111512e-17
Iteration 2: J1 error = 3.98211977e-07
Iteration 2: J2 error = 6.64200954e-08
Iteration 2: error = 3.98211977e-07
[Z_tp1, Y_tp1, log_gk_tp1]
[-sqrt(epsilon)*(W1_tp1*sigma_k1 + W2_tp1*sigma_k2 + W3_tp1*sigma_k3)*exp(0.5*Y_t) - epsilon*(Z_t*beta_k - alpha_k + phi_1*log(imk_t*phi_2 + 1.0) - 0.5*q_t**2*(sigma_k1**2 + sigma_k2**2 + sigma_k3**2)*exp(Y_t)) + log_gk_tp1, Z_t*beta_z*epsilon - Z_t + Z_tp1 - sqrt(epsilon)*(W1_tp1*sigma_z1 + W2_tp1*sigma_z2 + W3_tp1*sigma_z3)*exp(0.5*Y_t), -Y_t + Y_tp1 + beta_2*epsilon*(-mu_2*exp(-Y_t) + 1) - sqrt(epsilon)*(W1_tp1*sigma_y1 + W2_tp1*sigma_y2 + W3_tp1*sigma_y3)*exp(-0.5*Y_t) + 0.5*epsilon*q_t**2*(sigma_y1**2 + sigma_y2**2 + sigma_y3**2)*exp(-Y_t)]
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968993672636477
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358308937536
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402750360566
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358308937536
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123192938559636
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358339741041
  Equation 2: 8.34543252281605E-8
  Equation 3: -0.250402731337517
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358339741041
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727306135664
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 9.19587321845938E-8
  Equation 3: -0.250402772870156
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338151722814
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0000000149011612
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667619978970
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0000000149011612
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276348856458
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0000000149011612
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402741459475
  Equation 4: -0.0160667614640710
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358337698094
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842028876096
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358333908130
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743770222
  Equation 4: -0.0160667617533380
  Equation 5: -0.0600276341268781
  Equation 6: -0.00557358333908130
  Equation 7: 0.0145338156371238
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 1.4901161193880158e-08
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338151993512
  Equation 8: 2.08616256714322E-10
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.974960741559176

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276254416350
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 8.87586832504228E-9
Variable Dictionary:
  vmk_t: -2.4990412620769447
  log_cmk_t: -3.8188399396908546
  imk_t: 0.07107896538859211
  m0_t: 0.6708625092622533
  m1_t: 0.11979133410667753
  mg_t: 1.0000000000000009
  log_gk_t: 0.004078415544384683
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -0.000301532242793315
  Equation 2: 0.0386458943704886
  Equation 3: -0.0700506740870134
  Equation 4: -0.00243311177293890
  Equation 5: -0.00632609272245618
  Equation 6: 0.000301532242793311
  Equation 7: 0.00000954912477009462
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.5931567574112755
  log_cmk_t: -3.7289026398205487
  imk_t: 0.06875688288000965
  m0_t: 0.548219847461722
  m1_t: -0.02307775158220332
  mg_t: 0.9999999999999996
  log_gk_t: 0.003704197375870328
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -0.0000631230706961651
  Equation 2: 0.0242757003594813
  Equation 3: -0.0273500781652956
  Equation 4: -0.0000658967204150204
  Equation 5: 0.00121462877264170
  Equation 6: 0.0000631230706961668
  Equation 7: 0.00000762066205286290
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.638449426639722
  log_cmk_t: -3.6719560781959393
  imk_t: 0.06698705419426898
  m0_t: 0.5238878109405951
  m1_t: -0.014533835038480864
  mg_t: 0.9999999999999991
  log_gk_t: 0.003413314651906058
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 0.0000116178985622405
  Equation 2: 0.00844161572937896
  Equation 3: -0.00394579816985263
  Equation 4: 0.000455193416019484
  Equation 5: 0.000762942441250680
  Equation 6: -0.0000116178985622370
  Equation 7: 0.00000349570250840351
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6434607937665993
  log_cmk_t: -3.6648097637088544
  imk_t: 0.06662582872674504
  m0_t: 0.541038981121622
  m1_t: -0.0013164503468426191
  mg_t: 0.9999999999999993
  log_gk_t: 0.0033515161371127622
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 0.00000621795361824447
  Equation 2: 0.00136260774340347
  Equation 3: -0.000298049568510650
  Equation 4: 0.000160809857545657
  Equation 5: 0.0000690675012368642
  Equation 6: -0.00000621795361824187
  Equation 7: 5.49742981579334E-7
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6427858769844788
  log_cmk_t: -3.663844175070631
  imk_t: 0.06656774129621157
  m0_t: 0.5481768298579396
  m1_t: 0.00011164568845901794
  mg_t: 0.9999999999999996
  log_gk_t: 0.00334151534734168
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 0.00000184305788123503
  Equation 2: 0.0000594400760061120
  Equation 3: 0.000144296664201377
  Equation 4: 0.0000342938686621053
  Equation 5: -0.00000585695644572449
  Equation 6: -0.00000184305788123330
  Equation 7: 2.31843045443193E-8
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.642293766679322
  log_cmk_t: -3.6640636968089506
  imk_t: 0.06657255574351265
  m0_t: 0.5493062604246624
  m1_t: 7.64708886791394e-06
  mg_t: 0.9999999999999997
  log_gk_t: 0.0033422862639455736
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 7.46372257013662E-7
  Equation 2: 0.0000277636445140672
  Equation 3: 0.0000518888867312994
  Equation 4: 0.0000136351400746582
  Equation 5: -4.01170693472762E-7
  Equation 6: -7.46372257011928E-7
  Equation 7: 8.74118862188855E-9
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6420121515313357
  log_cmk_t: -3.6641583544202163
  imk_t: 0.06657432656093322
  m0_t: 0.5499712673821173
  m1_t: -3.1292639966093615e-06
  mg_t: 0.9999999999999999
  log_gk_t: 0.003342567081851625
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 1.03154115142085E-7
  Equation 2: 0.00000220689972829646
  Equation 3: 0.00000858569987771673
  Equation 4: 0.00000151851223440837
  Equation 5: 1.64163410802474E-7
  Equation 6: -1.03154115141217E-7
  Equation 7: 6.98362936490254E-10
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.641954245079993
  log_cmk_t: -3.664181927080247
  imk_t: 0.06657485733246968
  m0_t: 0.5500820857994922
  m1_t: -1.111886782868601e-06
  mg_t: 1.0
  log_gk_t: 0.0033426527571405983
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -2.37681131477763E-8
  Equation 2: -6.53054561983168E-7
  Equation 3: -0.00000185359081250613
  Equation 4: -5.11343997488395E-7
  Equation 5: 5.83304151165340E-8
  Equation 6: 2.37681131477763E-8
  Equation 7: -2.06777919439793E-10
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.641964570247612
  log_cmk_t: -3.664177927424757
  imk_t: 0.066574770978437
  m0_t: 0.5500568860059079
  m1_t: -1.9422963398257696e-07
  mg_t: 1.0
  log_gk_t: 0.003342638870283248
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -8.68045460164502E-10
  Equation 2: -2.32881025574727E-8
  Equation 3: -6.83356736475016E-8
  Equation 4: -5.12985432448571E-8
  Equation 5: 1.01894310930291E-8
  Equation 6: 8.68045460164502E-10
  Equation 7: -7.42287698321520E-12
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6419649683024446
  log_cmk_t: -3.6641777715933546
  imk_t: 0.06657476759180911
  m0_t: 0.5500546124929157
  m1_t: -1.9740150403183506e-08
  mg_t: 1.0
  log_gk_t: 0.0033426383253947764
  Z_t: -5.123497510187612e-41
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 1.34565882742299E-11
  Equation 2: 3.83401310699583E-10
  Equation 3: 1.03601990875113E-9
  Equation 4: -9.98819836908749E-9
  Equation 5: 1.03558297045201E-9
  Equation 6: -1.34565882742299E-11
  Equation 7: 1.21114056284011E-13
  Equation 8: -7.17289651426266E-43
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6419649633748024
  log_cmk_t: -3.664177773441421
  imk_t: 0.06657476763076715
  m0_t: 0.5500542311196926
  m1_t: -2.6035421405655454e-09
  mg_t: 1.0
  log_gk_t: 0.003342638331647379
  Z_t: 1.5886845991479667e-39
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 2.46759730704316E-12
  Equation 2: 5.56350521208060E-11
  Equation 3: 2.05184508272893E-10
  Equation 4: -3.08540203108887E-9
  Equation 5: 1.36583756896872E-10
  Equation 6: -2.46759730704316E-12
  Equation 7: 1.88174129056584E-14
  Equation 8: 2.22415843880715E-41
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6419649633748024
  log_cmk_t: -3.664177773441421
  imk_t: 0.06657476763076715
  m0_t: 0.5500542311196926
  m1_t: -2.6035421405655454e-09
  mg_t: 1.0
  log_gk_t: 0.003342638331647379
  Z_t: 1.5886845991479667e-39
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 2.46759730704316E-12
  Equation 2: 5.56350521208060E-11
  Equation 3: 2.05184508272893E-10
  Equation 4: -3.08540203108887E-9
  Equation 5: 1.36583756896872E-10
  Equation 6: -2.46759730704316E-12
  Equation 7: 1.88174129056584E-14
  Equation 8: 2.22415843880715E-41
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968993672636477
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358308937536
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402750360566
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358308937536
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123192938559636
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358339741041
  Equation 2: 8.34543252281605E-8
  Equation 3: -0.250402731337517
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358339741041
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727306135664
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 9.19587321845938E-8
  Equation 3: -0.250402772870156
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338151722814
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0000000149011612
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667619978970
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0000000149011612
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276348856458
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0000000149011612
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402741459475
  Equation 4: -0.0160667614640710
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358337698094
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842028876096
  Z_t: 0.0
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358333908130
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743770222
  Equation 4: -0.0160667617533380
  Equation 5: -0.0600276341268781
  Equation 6: -0.00557358333908130
  Equation 7: 0.0145338156371238
  Equation 8: 0
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 1.4901161193880158e-08
  Y_t: -11.97496092

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276339911644
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338151993512
  Equation 8: 2.08616256714322E-10
  Equation 9: 2.21489222795856E-10
Variable Dictionary:
  vmk_t: -2.1968994
  log_cmk_t: -4.123193
  imk_t: 0.07600727192876003
  m0_t: 1.0
  m1_t: 1.0
  mg_t: 1.0
  log_gk_t: 0.01937842
  Z_t: 0.0
  Y_t: -11.974960741559176

Substituted Equations:
  Equation 1: 0.00557358319645006
  Equation 2: 2.20139613205106E-8
  Equation 3: -0.250402743748048
  Equation 4: -0.0160667616112773
  Equation 5: -0.0600276254416350
  Equation 6: -0.00557358319645006
  Equation 7: 0.0145338153483628
  Equation 8: 0
  Equation 9: 8.87586832504228E-9
Variable Dictionary:
  vmk_t: -2.4990412620769447
  log_cmk_t: -3.8188399396908546
  imk_t: 0.07107896538859211
  m0_t: 0.6708625092622533
  m1_t: 0.11979133410667753
  mg_t: 1.0000000000000009
  log_gk_t: 0.004078415544384683
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -0.000301532242793315
  Equation 2: 0.0386458943704886
  Equation 3: -0.0700506740870134
  Equation 4: -0.00243311177293890
  Equation 5: -0.00632609272245618
  Equation 6: 0.000301532242793311
  Equation 7: 0.00000954912477009462
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.5931567574112755
  log_cmk_t: -3.7289026398205487
  imk_t: 0.06875688288000965
  m0_t: 0.548219847461722
  m1_t: -0.02307775158220332
  mg_t: 0.9999999999999996
  log_gk_t: 0.003704197375870328
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -0.0000631230706961651
  Equation 2: 0.0242757003594813
  Equation 3: -0.0273500781652956
  Equation 4: -0.0000658967204150204
  Equation 5: 0.00121462877264170
  Equation 6: 0.0000631230706961668
  Equation 7: 0.00000762066205286290
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.638449426639722
  log_cmk_t: -3.6719560781959393
  imk_t: 0.06698705419426898
  m0_t: 0.5238878109405951
  m1_t: -0.014533835038480864
  mg_t: 0.9999999999999991
  log_gk_t: 0.003413314651906058
  Z_t: 0.0
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 0.0000116178985622405
  Equation 2: 0.00844161572937896
  Equation 3: -0.00394579816985263
  Equation 4: 0.000455193416019484
  Equation 5: 0.000762942441250680
  Equation 6: -0.0000116178985622370
  Equation 7: 0.00000349570250840351
  Equation 8: 0
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6434607937665993
  log_cmk_t: -3.6648097637088544
  imk_t: 0.06662582872674504
  m0_t: 0.541038981121622
  m1_t: -0.0013164503468426191
  mg_t: 0.9999999999999993
  log_gk_t: 0.0033515161371127622
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 0.00000621795361824447
  Equation 2: 0.00136260774340347
  Equation 3: -0.000298049568510650
  Equation 4: 0.000160809857545657
  Equation 5: 0.0000690675012368642
  Equation 6: -0.00000621795361824187
  Equation 7: 5.49742981579334E-7
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6427858769844788
  log_cmk_t: -3.663844175070631
  imk_t: 0.06656774129621157
  m0_t: 0.5481768298579396
  m1_t: 0.00011164568845901794
  mg_t: 0.9999999999999996
  log_gk_t: 0.00334151534734168
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 0.00000184305788123503
  Equation 2: 0.0000594400760061120
  Equation 3: 0.000144296664201377
  Equation 4: 0.0000342938686621053
  Equation 5: -0.00000585695644572449
  Equation 6: -0.00000184305788123330
  Equation 7: 2.31843045443193E-8
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.642293766679322
  log_cmk_t: -3.6640636968089506
  imk_t: 0.06657255574351265
  m0_t: 0.5493062604246624
  m1_t: 7.64708886791394e-06
  mg_t: 0.9999999999999997
  log_gk_t: 0.0033422862639455736
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 7.46372257013662E-7
  Equation 2: 0.0000277636445140672
  Equation 3: 0.0000518888867312994
  Equation 4: 0.0000136351400746582
  Equation 5: -4.01170693472762E-7
  Equation 6: -7.46372257011928E-7
  Equation 7: 8.74118862188855E-9
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6420121515313357
  log_cmk_t: -3.6641583544202163
  imk_t: 0.06657432656093322
  m0_t: 0.5499712673821173
  m1_t: -3.1292639966093615e-06
  mg_t: 0.9999999999999999
  log_gk_t: 0.003342567081851625
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 1.03154115142085E-7
  Equation 2: 0.00000220689972829646
  Equation 3: 0.00000858569987771673
  Equation 4: 0.00000151851223440837
  Equation 5: 1.64163410802474E-7
  Equation 6: -1.03154115141217E-7
  Equation 7: 6.98362936490254E-10
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.641954245079993
  log_cmk_t: -3.664181927080247
  imk_t: 0.06657485733246968
  m0_t: 0.5500820857994922
  m1_t: -1.111886782868601e-06
  mg_t: 1.0
  log_gk_t: 0.0033426527571405983
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -2.37681131477763E-8
  Equation 2: -6.53054561983168E-7
  Equation 3: -0.00000185359081250613
  Equation 4: -5.11343997488395E-7
  Equation 5: 5.83304151165340E-8
  Equation 6: 2.37681131477763E-8
  Equation 7: -2.06777919439793E-10
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.641964570247612
  log_cmk_t: -3.664177927424757
  imk_t: 0.066574770978437
  m0_t: 0.5500568860059079
  m1_t: -1.9422963398257696e-07
  mg_t: 1.0
  log_gk_t: 0.003342638870283248
  Z_t: 1.2511593431471581e-44
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: -8.68045460164502E-10
  Equation 2: -2.32881025574727E-8
  Equation 3: -6.83356736475016E-8
  Equation 4: -5.12985432448571E-8
  Equation 5: 1.01894310930291E-8
  Equation 6: 8.68045460164502E-10
  Equation 7: -7.42287698321520E-12
  Equation 8: 1.75162308040602E-46
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6419649683024446
  log_cmk_t: -3.6641777715933546
  imk_t: 0.06657476759180911
  m0_t: 0.5500546124929157
  m1_t: -1.9740150403183506e-08
  mg_t: 1.0
  log_gk_t: 0.0033426383253947764
  Z_t: -5.123497510187612e-41
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 1.34565882742299E-11
  Equation 2: 3.83401310699583E-10
  Equation 3: 1.03601990875113E-9
  Equation 4: -9.98819836908749E-9
  Equation 5: 1.03558297045201E-9
  Equation 6: -1.34565882742299E-11
  Equation 7: 1.21114056284011E-13
  Equation 8: -7.17289651426266E-43
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6419649633748024
  log_cmk_t: -3.664177773441421
  imk_t: 0.06657476763076715
  m0_t: 0.5500542311196926
  m1_t: -2.6035421405655454e-09
  mg_t: 1.0
  log_gk_t: 0.003342638331647379
  Z_t: 1.5886845991479667e-39
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 2.46759730704316E-12
  Equation 2: 5.56350521208060E-11
  Equation 3: 2.05184508272893E-10
  Equation 4: -3.08540203108887E-9
  Equation 5: 1.36583756896872E-10
  Equation 6: -2.46759730704316E-12
  Equation 7: 1.88174129056584E-14
  Equation 8: 2.22415843880715E-41
  Equation 9: 1.38777878078145E-17
Variable Dictionary:
  vmk_t: -2.6419649633748024
  log_cmk_t: -3.664177773441421
  imk_t: 0.06657476763076715
  m0_t: 0.5500542311196926
  m1_t: -2.6035421405655454e-09
  mg_t: 1.0
  log_gk_t: 0.003342638331647379
  Z_t: 1.5886845991479667e-39
  Y_t: -11.974960924566787

Substituted Equations:
  Equation 1: 2.46759730704316E-12
  Equation 2: 5.56350521208060E-11
  Equation 3: 2.05184508272893E-10
  Equation 4: -3.08540203108887E-9
  Equation 5: 1.36583756896872E-10
  Equation 6: -2.46759730704316E-12
  Equation 7: 1.88174129056584E-14
  Equation 8: 2.22415843880715E-41
  Equation 9: 1.38777878078145E-17
Iteration 1: mu_0 error = 4.85671225e-12
Iteration 1: J1 error = 0.0763109039
Iteration 1: J2 error = 0.149825263
Iteration 1: error = 0.149825263
Iteration 2: mu_0 error = 3.69260178e-13
Iteration 2: J1 error = 0.0742028963
Iteration 2: J2 error = 0.00377263883
Iteration 2: error = 0.0742028963
Iteration 3: mu_0 error = 2.83523205e-14
Iteration 3: J1 error = 0.0426752296
Iteration 3: J2 error = 0.0115643531
Iteration 3: error = 0.0426752296
Iteration 4: mu_0 error = 2.1649349e-15
Iteration 4: J1 error = 0.0196440557
Iteration 4: J2 error = 0.00631105131
Iteration 4: error = 0.0196440557
Iteration 5: mu_0 error = 1.66533454e-16
Iteration 5: J1 error = 0.00875601935
Iteration 5: J2 error = 0.00304739801
Iteration 5: error = 0.00875601935
Iteration 6: mu_0 error = 2.49800181e-16
Iteration 6: J1 error = 0.00388192984
Iteration 6: J2 error = 0.00145136446
Iteration 6: error = 0.00388192984
Iteration 7: mu_0 error = 6.9388939e-17
Iteration 7: J1 error = 0.00171945238
Iteration 7: J2 error = 0.000685601145
Iteration 7: error = 0.00171945238
Iteration 8: mu_0 error = 6.10622664e-16
Iteration 8: J1 error = 0.000761490256
Iteration 8: J2 error = 0.00032275865
Iteration 8: error = 0.000761490256
Iteration 9: mu_0 error = 6.80011603e-16
Iteration 9: J1 error = 0.000337230499
Iteration 9: J2 error = 0.000151362525
Iteration 9: error = 0.000337230499
Iteration 10: mu_0 error = 3.33066907e-16
Iteration 10: J1 error = 0.000149343847
Iteration 10: J2 error = 7.07720679e-05
Iteration 10: error = 0.000149343847
Iteration 11: mu_0 error = 1.11022302e-16
Iteration 11: J1 error = 6.61374547e-05
Iteration 11: J2 error = 3.2996527e-05
Iteration 11: error = 6.61374547e-05
Iteration 12: mu_0 error = 2.49800181e-16
Iteration 12: J1 error = 2.92892035e-05
Iteration 12: J2 error = 1.53458221e-05
Iteration 12: error = 2.92892035e-05
Iteration 13: mu_0 error = 4.02455846e-16
Iteration 13: J1 error = 1.29708261e-05
Iteration 13: J2 error = 7.12058416e-06
Iteration 13: error = 1.29708261e-05
Iteration 14: mu_0 error = 1.94289029e-16
Iteration 14: J1 error = 5.74417563e-06
Iteration 14: J2 error = 3.29715323e-06
Iteration 14: error = 5.74417563e-06

Note that the order of the variables listed in the solution is the same as before, except with \({\widehat V_t} - {\widehat C_t}\) removed:

\[ \left[ \widehat C_t - \widehat K_t, D_t, MX_t, MG_t, \widehat G_{t+1} - \widehat G_t, X_t \right] \]

2.6 Plot Elasticities#

First, if you did not run the code above, you can load a pre-solved solution by specifying save_path as follows:

save_path = 'output/res.pkl'
with open(save_path, 'rb') as f:
    ModelSol = pickle.load(f)

If you used the loop above, you can also use the following code to load all your solutions dynamically:

models = {}
for gamma_i in gamma_values:
    for rho_i in rho_values:
        save_path = 'output/single_capital_gamma_{}_rho_{}.pkl'.format(gamma_i, rho_i)
        try:
            with open(save_path, 'rb') as f:
                model_key = f"gamma_{gamma_i}_rho_{rho_i}"
                models[model_key] = pickle.load(f)
        except FileNotFoundError:
            print(f"File not found: {save_path}")

We can use plot_exposure_elasticity_quantiles to plot exposure elasticities for different shocks.

  • model_list is a list of solutions you want to use to compute elasticities

  • quantile specifies the quantiles to be plotted

  • T specifies the number of periods (using the time-unit that you specified the parameters in)

Additional optional parameters are included for aesthetics.

Here is an example:

def plot_exposure_quantiles(
    model_list, 
    quantile, 
    Mtgrowth_list,
    T, 
    num_shocks, 
    time_unit='quarters', 
    ylimits=None, 
    titles=None, 
    title=None, 
    shock_names=None, 
    colors=None, 
    save_path=None
):
    """
    Plot exposure elasticity quantiles for multiple models across subplots,
    with special handling for num_shocks = 1 (plots second shock only).
    
    Parameters:
    - model_list: List of model results to plot.
    - quantile: List of quantiles to calculate.
    - T: Integer, time horizon.
    - num_shocks: Integer, number of shocks to include.
    - time_unit: String, label for x-axis time units (e.g., "quarters").
    - ylimits: List, optional y-axis limits for the subplots.
    - titles: List of titles for individual subplots.
    - title: String, optional title for the overall figure.
    - shock_names: List of strings, names for the shocks (optional).
    - colors: List of strings, colors for the quantiles.
    - save_path: String, optional path to save the plot.
    """
    sns.set_style("darkgrid")
    num_models = len(model_list)

    # Default settings
    if titles is None:
        titles = [f'Model {i + 1}' for i in range(num_models)]
    if shock_names is None:
        shock_names = [f'Shock {i + 1}' for i in range(num_shocks)]
    if colors is None:
        colors = ['green', 'red', 'blue']

    # Adjust num_shocks and shock_names if num_shocks = 1
    if num_shocks == 1:
        num_shocks = 1
        shock_names = [shock_names[1] if len(shock_names) > 1 else "Shock 2"]

    # Initialize figure and axes
    fig, axes = plt.subplots(
        num_shocks, num_models, figsize=(8 * num_models, 6 * num_shocks), squeeze=False
    )

    # Main plotting loop
    for model_idx, res in enumerate(model_list):
        Mtgrowth = Mtgrowth_list[model_idx]
        X1_tp1 = res['X1_tp1']
        X2_tp1 = res['X2_tp1']
        
        # Calculate exposure elasticity for each shock
        expo_elas_shocks = [
            [exposure_elasticity(Mtgrowth, X1_tp1, X2_tp1, T, shock=i, percentile=p) for p in quantile]
            for i in range(num_shocks if num_shocks > 1 else 2)  # Include shock 2 when num_shocks = 1
        ]

        # Select only the second shock if num_shocks = 1
        if num_shocks == 1:
            expo_elas_shocks = [expo_elas_shocks[1]]

        # Prepare data for plotting
        index = ['T'] + [f'{q} quantile' for q in quantile]
        shock_data = [
            pd.DataFrame([np.arange(T), *[e.flatten() for e in expo_elas_shocks[i]]], index=index).T
            for i in range(len(expo_elas_shocks))
        ]

        # Plot each shock in a separate subplot
        for shock_idx in range(len(expo_elas_shocks)):
            ax = axes[shock_idx, model_idx]
            for quantile_idx, quantile_label in enumerate(index[1:]):
                sns.lineplot(data=shock_data[shock_idx], x='T', y=quantile_label, ax=ax, 
                             color=colors[quantile_idx], label=quantile_label)

            # Customize the subplot
            ax.set_xlabel('')
            ax.set_ylabel('Exposure elasticity', fontsize=14)
            if shock_names:
                ax.set_title(f'{titles[model_idx]} - {shock_names[shock_idx]}', fontsize=16)
            else:
                ax.set_title(f'{titles[model_idx]} - Shock {shock_idx + 1}', fontsize=16)
            ax.tick_params(axis='y', labelsize=12)
            ax.tick_params(axis='x', labelsize=12)
            ax.legend(fontsize=12, loc='lower right')

            # Set y-axis limits if provided
            if ylimits:
                ax.set_ylim(ylimits)

    # Set x-axis label for all subplots
    for ax_row in axes:
        for ax in ax_row:
            ax.set_xlabel(f'{time_unit}', fontsize=14)

    # Set the main figure title, if provided
    if title:
        fig.suptitle(title, fontsize=18)

    plt.tight_layout()

    # Save and/or display the plot
    if save_path:
        plt.savefig(save_path, dpi=300)
    plt.show()

Here is an example: first we define a function for computing the approximation of the log growth of \(M_t\). As an example, we compute the log growth of \(C^t\), where we know from the ordering above that this has index [0] in the output array. We subtract the first difference of this from \(\hat{G}_{t+1}-\hat{G}_t\), which is has index [0] in the array of state variables.

def compute_logMtM0(model):
    return model['JX1_tp1'][0] + 0.5 * model['JX2_tp1'][0] - (
        model['J1_t'][0] + 0.5 * model['J2_t'][0]) \
        + (model['X0_t'][0] + model['X1_tp1'][0] + 0.5 * model['X2_tp1'][0])

You can use the following code to plot the results for a selection of models.

model_list=[
        models['gamma_1.001_rho_1.5']
    ]

plot_exposure_quantiles(
    model_list,
    quantile=[0.1, 0.5, 0.9],
    Mtgrowth_list = [compute_logMtM0(model) for model in model_list],
    T=160,
    num_shocks=1,
    time_unit='quarters',
    titles=None,
    title=None,
    save_path=None
)
../../_images/3c173be70e5d5ed660a8fb0b29cf60dc422d5e54cd671020e994b3b31baba6ab.png

It is also possible to compute price elasticities similarly:

def plot_price_elasticity(models, T, quantile, time_unit, title=None, ylimits=None, save_path=None):
    """
    Calculate and plot price elasticity for different models across subplots.
    
    Parameters:
    - models: List of result dictionaries to plot.
    - T: Integer, time horizon.
    - quantile: List of quantiles to calculate.
    - time_unit: String, label for x-axis time units (e.g., "quarters").
    - ylimits: Optional, list of y-axis limits for each subplot.
    - save_path: Optional, path to save the figure.
    """
    sns.set_style("darkgrid")
    num_models = len(models)

    # Initialize figure and axes for subplots
    fig, axes = plt.subplots(1, num_models, figsize=(8 * num_models, 8), squeeze=False)
    axes = axes.flatten()  # Ensure axes are flattened for easy iteration
    titles = [r'$\gamma=1$',r'$\gamma=4$',r'$\gamma=8$']

    for idx, res in enumerate(models):
        # Extract data from the current model
        X1_tp1 = res['X1_tp1']
        X2_tp1 = res['X2_tp1']
        gc_tp1 = res['gc_tp1']
        vmr_tp1 = res['vmr1_tp1'] + 0.5 * res['vmr2_tp1']
        logNtilde = res['log_N_tilde']

        # Calculate log_SDF
        β = get_parameter_value('beta', res['parameter_names'], res['args'])
        ρ = get_parameter_value('rho', res['parameter_names'], res['args'])
        log_SDF = np.log(β) - ρ * gc_tp1 + (ρ - 1) * vmr_tp1 + logNtilde

        # Calculate price elasticity for each shock
        price_elas_shock = [
            price_elasticity(gc_tp1, log_SDF, X1_tp1, X2_tp1, T, shock=1, percentile=p) for p in quantile
        ]

        # Prepare data for plotting
        index = ['T'] + [f'{q} quantile' for q in quantile]
        shock_data = pd.DataFrame(
            [np.arange(T), *[e.flatten() for e in price_elas_shock]],
            index=index
        ).T

        # Plot on the respective subplot
        ax = axes[idx]
        qt = [f'{q} quantile' for q in quantile]
        colors = ['green', 'red', 'blue']

        for j in range(len(quantile)):
            sns.lineplot(data=shock_data, x='T', y=qt[j], ax=ax, color=colors[j], label=qt[j])
        
        # Customize the subplot
        ax.set_xlabel(time_unit, fontsize=30)
        ax.set_ylabel('Price elasticity', fontsize=30)
        ax.set_title(titles[idx], fontsize=30)
        ax.tick_params(axis='y', labelsize=30)
        ax.tick_params(axis='x', labelsize=30)
        if idx == 0:
            ax.legend(fontsize=25)
        else:
            ax.legend().set_visible(False)

        # Set y-axis limits if provided
        # if ylimits and idx < len(ylimits):
        #     ax.set_ylim(ylimits[idx])
        if ylimits:
            ax.set_ylim(ylimits)
    plt.tight_layout()

    # Save and/or display the plot
    if save_path:
        plt.savefig(save_path, dpi=500)
    plt.show()
model_list = [models['gamma_1.001_rho_1.5'],models['gamma_8.001_rho_1.5']]
T = 160
plot_price_elasticity(model_list,T,[0.1,0.5,0.9],'quarters','0',[0,0.25],None)
../../_images/ee4151c5d624939dfaa10873ec91be6c8d07b19eacac90a76b3e845cd61eb4fc.png



3 Outputs#

3.1 List of Outputs #

We now examine the contents of ModelSol, which contains the attributes listed below. Each approximation is stored in a class LinQuadVar, which contains the coefficients for \(X_{1,t}, X_{2,t}, X_{1,t}'X_{1,t}, W_{t+\epsilon}, W_{t+\epsilon}'W_{t+\epsilon}, X_{1,t}'W_{t+\epsilon}\) and the constant.

Input

Type

Description

JXn_t

LinQuadVar

Approximation of jump and state variables at time \(t\). Replace n with 0,1,2 to get the zeroth, first and second-order contribution. Omit n to get the full approximation. The variables are indexed in the order specified in Section 2.

Jn_t

LinQuadVar

Same as JXn_t but limited to jump variables.

Xn_tp1

LinQuadVar

Same as JXn_t but limited to state variables.

JXn_t_tilde

LinQuadVar

Same as JXn_t but using distorted measure. This variation is also available for Jn_t and Xn_tp1.

util_sol

dict

Dictionary containing solutions of the continuation values, including \(\mu^0, \Upsilon_0^2, \Upsilon_1^2,\) and \(\Upsilon_2^2\) etc.

vmrn_tp1

LinQuadVar

Approximation of continuation values \(\widehat{V}^1_{t+\epsilon}-\widehat{R}^1_t\) . Replace n with 0,1,2 to get the zeroth, first and second-order contribution. Omit n to get the full approximation.

gcn_tp1

LinQuadVar

Approximation of consumption growth \(\widehat{C}_{t+\epsilon}-\widehat{C}_t\) . Replace n with 0,1,2 to get the zeroth, first and second-order contribution. Omit n to get the full approximation.

ss

dict

Steady states for state and jump variables

log_N_tilde

LinQuadVar

Approximation for the log change of measure

For example, we can obtain the coefficients for the first-order contribution of \(\log{C_t/K_t}\) in the following way, noting that cmk_t was listed as the first jump variable when we specified the equilibrum conditions.

## Log consumption over capital approximation results, shown in the LinQuadVar coefficients form
ModelSol['JX1_t'][0].coeffs
{'c': array([[-0.00000005]]),
 'x': array([[ 0.        ,  0.00056165, -0.        ]])}

We can also display the full second-order approximation of \(\log{C_t/K_t}\) using the disp function, which renders a LinQuadVar object in LATEX form.

## Log consumption over capital approximation results, shown in the Latex analytical form
disp(ModelSol['JX_t'][0],'\\log\\frac{C_t}{K_t}') 
\[\begin{split}\displaystyle \log\frac{C_t}{K_t}=-4.127+\begin{bmatrix}2.116e-16&0.0005616\end{bmatrix}X_t^1+\begin{bmatrix}1.058e-16&0.0002808\end{bmatrix}X_t^2+X^{1T}_{t}\begin{bmatrix}7.68e-33&3.191e-20\\3.032e-76&-4.388e-20\end{bmatrix}X^1_{t}\end{split}\]

Another example:

## Log capital growth process second order approximation results
disp(ModelSol['X2_tp1'][0],'\\log\\frac{K_{t+\epsilon}^2}{K_t^2}') 
\[\begin{split}\displaystyle \log\frac{K_{t+\epsilon}^2}{K_t^2}=-1.9e-05+\begin{bmatrix}3.427e-26&1.26e-13\end{bmatrix}X_t^1+\begin{bmatrix}-3.388e-19&0.009999\end{bmatrix}X_t^2+X^{1T}_{t}\begin{bmatrix}-8.797e-35&-3.656e-22\\-1.521e-78&1.454e-23\end{bmatrix}X^1_{t}+X^{1T}_{t}\begin{bmatrix}0&0\\0&0\end{bmatrix}W_{t+1}\end{split}\]

3.2 Simulate Variables #

Given a series of shock processes, we can simulate the path of our state and jump variables using the ModelSolution.simulate method. Here, we simulate 400 periods of i.i.d standard multivariate normal shocks.

n_J, n_X, n_W = ModelSol['var_shape']
Ws = np.random.multivariate_normal(np.zeros(n_W),np.eye(n_W),size = 400)
JX_sim = ModelSol.simulate(Ws)


4 Using LinQuadVar in Computation #

In the previous section, we saw how to use uncertain_expansion to approximate variables and store their coefficients as LinQuadVar objects. In this section, we explore how to manipulate LinQuadVar objects for different uses.

To aid our examples, we first extract the steady states for the state evolution processes from the previous model solution:

See src/lin_quad.py for source code of LinQuadVar definition.

ModelSol['ss'][[0,1,2]]
array([-4.12667104,  0.07606349,  0.60576715])
n_J, n_X, n_W = ModelSol['var_shape']
print(n_J, n_X, n_W)
X0_tp1 = LinQuadVar({'c':np.array([[ModelSol['ss'][0]],[ModelSol['ss'][1]],[ModelSol['ss'][2]]])}, shape = (n_X, n_X, n_W))
5 3 3

4.1 LinQuadVar Operations #

We can sum multiple LinQuads together in two different ways. Here we demonstrate this with an example by summing the zeroth, first and second order contributions of our approximation for capital growth.

gk_tp1 = X0_tp1[0] + ModelSol['X1_tp1'][0]  + 0.5 * ModelSol['X2_tp1'][0] 
disp(gk_tp1,'\\log\\frac{K_{t+\epsilon}}{K_t}') 
\[\begin{split}\displaystyle \log\frac{K_{t+\epsilon}}{K_t}=-4.127+\begin{bmatrix}-3.388e-19&0.009999\end{bmatrix}X_t^1+\begin{bmatrix}0.004&0.001739\end{bmatrix}W_{t+1}+\begin{bmatrix}-1.694e-19&0.004999\end{bmatrix}X_t^2+X^{1T}_{t}\begin{bmatrix}-4.399e-35&-1.828e-22\\-7.605e-79&7.268e-24\end{bmatrix}X^1_{t}+X^{1T}_{t}\begin{bmatrix}0&0\\0&0\end{bmatrix}W_{t+1}\end{split}\]

In the next example, we sum together the contributions for both capital growth and technology:

lq_sum([X0_tp1, ModelSol['X1_tp1'], 0.5 * ModelSol['X2_tp1']]).coeffs
{'c': array([[-4.12668054],
        [ 0.07606349],
        [ 0.5828862 ]]),
 'x': array([[-0.        ,  0.00999859,  0.        ],
        [ 0.        ,  0.986     ,  0.        ],
        [ 0.        ,  0.        ,  0.9515    ]]),
 'xw': array([[ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,  0.        ,  0.00199981,  0.00086948,  0.        ],
        [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,  0.        ,  0.        ,  0.01239013,  0.        ],
        [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,  0.        ,  0.        ,  0.        , -0.10696016]]),
 'x2': array([[-0.       ,  0.0049993,  0.       ],
        [ 0.       ,  0.493    ,  0.       ],
        [ 0.       ,  0.       ,  0.47575  ]]),
 'xx': array([[-0.     , -0.     , -0.     ,  0.     , -0.     , -0.     ,  0.     ,  0.     ,  0.     ],
        [ 0.     ,  0.     ,  0.     ,  0.     ,  0.     ,  0.     ,  0.     ,  0.     ,  0.     ],
        [ 0.     ,  0.     ,  0.     ,  0.     ,  0.     ,  0.     ,  0.     ,  0.     ,  0.02425]]),
 'w': array([[0.00399962, 0.00173897, 0.        ],
        [0.        , 0.02478025, 0.        ],
        [0.        , 0.        , 0.21392032]])}

4.2 LinQuadVar Split and Concat #

split breaks multiple dimensional LinQuad into one-dimensional LinQuads, while concat does the inverse.

gk_tp1, Z_tp1, Y_tp1 = ModelSol['X1_tp1'].split()
concat([gk_tp1, Z_tp1, Y_tp1])
<lin_quad.LinQuadVar at 0x17562a1e0>

4.3 Evaluate a LinQuadVar #

We can evaluate a LinQuad at specific state \((X_{t},W_{t+\epsilon})\) in time. As an example, we evaluate all 5 variables under steady state with a multivariate random normal shock.

x1 = np.zeros([n_X ,1])
x2 = np.zeros([n_X ,1])
x3 = np.zeros([n_X, 1])
w = np.random.multivariate_normal(np.zeros(n_W),np.eye(n_W),size = 1).T
ModelSol['JX_tp1'](*(x1,x2,w))
array([[ -4.12667002],
       [  0.07606348],
       [  0.60576726],
       [ -0.00018954],
       [  1.        ],
       [  0.00223285],
       [  0.00817758],
       [-11.99963929]])

4.4 Next period expression for LinQuadVar #

ModelSol allows us to express a jump variable \(J_t\) as a function of \(t\) state and shock variables. Suppose we would like to compute its next period expression \(J_{t+\epsilon}\) with shocks. The function next_period expresses \(J_{t+\epsilon}\) in terms of \(t\) state variables and \(t+\epsilon\) shock variables. For example, we can express the \(t+\epsilon\) expression for the first-order contribution to consumption over capital as:

ModelSol["X1_tp1"].coeffs
{'x': array([[-0.        ,  0.03710412, -0.        ,  0.00006824],
        [-0.        ,  0.944     , -0.        , -0.        ],
        [-0.        , -0.        ,  0.806     , -0.        ],
        [ 0.        , -0.0366626 ,  0.        , -0.10516689]]),
 'w': array([[ 0.00799924,  0.00347793, -0.        ],
        [-0.        ,  0.04956051, -0.        ],
        [-0.        , -0.        ,  0.42784065],
        [-0.00799924, -0.00347793, -0.        ]]),
 'c': array([[ 0.00111162],
        [ 0.        ],
        [ 0.        ],
        [-0.0012811 ]])}
cmk1_tp1 = next_period(ModelSol['J1_t'][0], ModelSol['X1_tp1'])
disp(cmk1_tp1, '\\log\\frac{C_{t+\epsilon}^1}{K_{t+\epsilon}^1}') 
\[\displaystyle \log\frac{C_{t+\epsilon}^1}{K_{t+\epsilon}^1}=-5.482e-08+\begin{bmatrix}-7.17e-35&0.0005538\end{bmatrix}X_t^1+\begin{bmatrix}8.464e-19&1.392e-05\end{bmatrix}W_{t+1}\]
cmk2_tp1 = next_period(ModelSol['J2_t'][0], ModelSol['X1_tp1'], ModelSol['X2_tp1'])
disp(cmk2_tp1, '\\log\\frac{C_{t+\epsilon}^2}{K_{t+\epsilon}^2}') 
\[\begin{split}\displaystyle \log\frac{C_{t+\epsilon}^2}{K_{t+\epsilon}^2}=-7.039e-06+\begin{bmatrix}6.46e-42&1.605e-11\end{bmatrix}X_t^1+\begin{bmatrix}9.347e-27&4.033e-13\end{bmatrix}W_{t+1}+\begin{bmatrix}-7.17e-35&0.0005538\end{bmatrix}X_t^2+X^{1T}_{t}\begin{bmatrix}-1.862e-50&-9.87e-38\\-5.174e-94&3.24e-38\end{bmatrix}X^1_{t}+X^{1T}_{t}\begin{bmatrix}-4.163e-53&2.01e-40\\-4.396e-95&-9.443e-23\end{bmatrix}W_{t+1}+W_{t+1}^{T}\begin{bmatrix}2.457e-37&6.325e-24\\5.189e-79&-8.698e-24\end{bmatrix}W_{t+1}\end{split}\]

4.6 Compute the Expectation of time \(t+\epsilon\) LinQuadVar #

Suppose the distribution of shocks has a constant mean and variance (not state dependent). Then, we can use the E function to compute the expectation of a time \(t+\epsilon\) LinQuadVar as follows:

E_w = ModelSol['util_sol']['μ_0']
cov_w = np.eye(n_W)
E_ww = cal_E_ww(E_w, cov_w)
E_cmk2_tp1 = E(cmk2_tp1, E_w, E_ww)
disp(E_cmk2_tp1, '\mathbb{E}[\\log\\frac{C_{t+\epsilon}^2}{K_{t+\epsilon}^2}|\mathfrak{F_t}]')
\[\begin{split}\displaystyle \mathbb{E}[\log\frac{C_{t+\epsilon}^2}{K_{t+\epsilon}^2}|\mathfrak{F_t}]=-7.039e-06+\begin{bmatrix}6.456e-42&1.609e-11\end{bmatrix}X_t^1+\begin{bmatrix}-7.17e-35&0.0005538\end{bmatrix}X_t^2+X^{1T}_{t}\begin{bmatrix}-1.862e-50&-9.87e-38\\-5.174e-94&3.24e-38\end{bmatrix}X^1_{t}\end{split}\]

Suppose the distribution of shock has a state-dependent mean and variance (implied by \(\tilde{N}_{t+\epsilon}\) shown in the notes), we can use E_N_tp1 and N_tilde_measure to compute the expectation of time \(t+\epsilon\) LinQuadVar.

N_cm = N_tilde_measure(ModelSol['util_sol']['log_N_tilde'],(1,n_X,n_W))
E_cmk2_tp1_tilde = E_N_tp1(cmk2_tp1, N_cm)
disp(E_cmk2_tp1_tilde, '\mathbb{\\tilde{E}}[\\log\\frac{C_{t+\epsilon}^2}{K_{t+\epsilon}^2}|\mathfrak{F_t}]')
\[\begin{split}\displaystyle \mathbb{\tilde{E}}[\log\frac{C_{t+\epsilon}^2}{K_{t+\epsilon}^2}|\mathfrak{F_t}]=-7.039e-06+\begin{bmatrix}6.456e-42&1.609e-11\end{bmatrix}X_t^1+\begin{bmatrix}-7.17e-35&0.0005538\end{bmatrix}X_t^2+X^{1T}_{t}\begin{bmatrix}-1.862e-50&-9.87e-38\\1.354e-50&3.24e-38\end{bmatrix}X^1_{t}\end{split}\]