Steady-State Functions#
SS.py modules
ogcore.SS#
- ogcore.SS.SS_fsolve(guesses, *args)[source]#
Solves for the steady state distribution of capital, labor, as well as w, r, TR and the scaling factor, using a root finder.
- Parameters:
guesses (list) – initial guesses outer loop variables (r_p, r, w, p_m, BQ, TR (or Y), factor)
args (tuple) – tuple of arguments (bssmat, nssmat, TR_ss, factor_ss, p, client)
bssmat (Numpy array) – initial guess at savings, size = SxJ
nssmat (Numpy array) – initial guess at labor supply, size = SxJ
TR_ss (scalar) – lump sum transfer amount
factor_ss (scalar) – scaling factor converting model units to dollars
p (OG-Core Specifications object) – model parameters
client (Dask client object) – client
- Returns:
- errors from differences between guessed and
implied outer loop variables
- Return type:
errors (list)
- ogcore.SS.SS_initial_guesses(p, b_val=0.0055, n_val=0.4, r_tr_scalars=[1.0, 1.0])[source]#
Finds the initial guesses for b, n and for the steady state outer loop variables.
- Parameters:
p (OG-Core Specifications object) – model parameters
b_val (float) – initial guess value for savings
n_val (float) – initial guess value for labor supply
r_tr_scalars (list) – scalars to adjust initial guesses for r and TR
- Returns:
initial guesses for outer loop variables b_guess (ndarray): initial guess for savings n_guess (ndarray): initial guess for labor supply
- Return type:
guesses (list)
- ogcore.SS.SS_solver(bmat, nmat, r_p, r, w, p_m, Y, BQ, TR, Ig_baseline, factor, p, client, fsolve_flag=False)[source]#
Solves for the steady state distribution of capital, labor, as well as w, r, TR and the scaling factor, using functional iteration.
- Parameters:
bmat (Numpy array) – initial guess at savings, size = SxJ
nmat (Numpy array) – initial guess at labor supply, size = SxJ
r_p (scalar) – return on household investment portfolio
r (scalar) – real interest rate
w (scalar) – real wage rate
p_m (array_like) – good prices
Y (scalar) – real GDP
BQ (array_like) – aggregate bequest amount(s)
TR (scalar) – lump sum transfer amount
factor (scalar) – scaling factor converting model units to dollars
p (OG-Core Specifications object) – model parameters
client (Dask client object) – client
- Returns:
- dictionary with steady state solution
results
- Return type:
output (dictionary)
- ogcore.SS.euler_equation_solver(guesses, *args)[source]#
Finds the euler errors for certain b and n, one ability type at a time.
- Parameters:
guesses (Numpy array) – initial guesses for b and n, length 2S
args (tuple) – tuple of arguments (r, w, p_tilde, p_i, bq, TR, factor, j, p)
r (scalar) – real interest rate
w (scalar) – real wage rate
p_tilde (scalar) – composite good price
bq (Numpy array) – bequest amounts by age, length S
rm (scalar) – remittance amounts by age, length S
tr (scalar) – government transfer amount by age, length S
ubi (vector) – universal basic income (UBI) payment, length S
factor (scalar) – scaling factor converting model units to dollars
p (OG-Core Specifications object) – model parameters
- Returns:
errors from FOCs, length 2S
- Return type:
errros (Numpy array)
- ogcore.SS.inner_loop(outer_loop_vars, p, client)[source]#
This function solves for the inner loop of the SS. That is, given the guesses of the outer loop variables (r, w, TR, factor) this function solves the households’ problems in the SS.
- Parameters:
outer_loop_vars (tuple) – tuple of outer loop variables, (bssmat, nssmat, r_p, r, w, p_m, BQ, RM, TR, factor) or (bssmat, nssmat, r_p, r, w, p_m, BQ, RM, Y, TR, factor)
bssmat (Numpy array) – initial guess at savings, size = SxJ
nssmat (Numpy array) – initial guess at labor supply, size = SxJ
r_p (scalar) – return on household investment portfolio
r (scalar) – real interest rate
w (scalar) – real wage rate
p_m (array_like) – production goods prices
BQ (array_like) – aggregate bequest amount(s)
TR (scalar) – lump sum transfer amount
Y (scalar) – real GDP
factor (scalar) – scaling factor converting model units to dollars
p (OG-Core Specifications object) – model parameters
client (Dask client object) – client
- Returns:
results from household solution:
- euler_errors (Numpy array): errors terms from FOCs,
size = 2SxJ
bssmat (Numpy array): savings, size = SxJ
nssmat (Numpy array): labor supply, size = SxJ
new_r (scalar): real interest rate on firm capital
new_r_gov (scalar): real interest rate on government debt
- new_r_p (scalar): real interest rate on household
portfolio
new_w (scalar): real wage rate
new_p_i (array_like): good prices
K_vec (array_like): capital demand for each industry
L_vec (array_like): labor demand for each industry
Y_vec (array_like): output from each industry
new_TR (scalar): lump sum transfer amount
new_Y (scalar): real GDP
- new_factor (scalar): scaling factor converting model
units to dollars
new_BQ (array_like): aggregate bequest amount(s)
- average_income_model (scalar): average income in model
units
- Return type:
(tuple)
- ogcore.SS.run_SS(p, client=None)[source]#
Solve for steady-state equilibrium of OG-Core.
- Parameters:
p (OG-Core Specifications object) – model parameters
client (Dask client object) – client
- Returns:
- dictionary with steady-state solution
results
- Return type:
output (dictionary)
- ogcore.SS.solve_for_j(guesses, r_p, w, p_tilde, p_i, bq_j, rm_j, tr_j, ubi_j, factor, j, p_future)[source]#
Solves the household’s optimization problem for a given type j.
- Parameters:
guesses (Numpy array) – initial guesses for b and n, length 2S
r_p (scalar) – return on household investment portfolio
w (scalar) – real wage rate
p_tilde (scalar) – composite good price
p_i (Numpy array) – prices for consumption good i
bq_j (Numpy array) – bequest amounts by age, length S
rm_j (Numpy array) – remittance amounts by age, length S
tr_j (Numpy array) – government transfer amount by age, length S
ubi_j (vector) – universal basic income (UBI) payment, length S
factor (scalar) – scaling factor converting model units to dollars
j (int) – household type index
p_future (OG-Core Specifications object) – future model parameters
- Returns:
the optimization result
- Return type:
root (OptimizeResult)