This repository contains code for solving a New Keynesian model with a Noisy Taylor Rule, as described in "Rough Notes".
-
NK_solution– Script for a single-seed solution with a -1 SD TFP shock.
Produces:- IRF plot
- IRF CSV file:
IRF_shock_z_wide.csv
-
NK_seed_experiment– Runs experiments with 10 random seeds.
Produces:IRF_seed_*files and plotsseed_torch_exp_{date}(for MIT shock IRFs)IRF_noisy_seed_*files and plotsseed_torch_exp_{date}(for noisy shock IRFs)
-
NK_solution_seed– Wrapper forNK_solution, used withinNK_seed_experiment. -
NK_NN_architecture– Neural network architecture setup module. -
NK_residuals– Main module for computing loss functions. -
NK_simulations– Contains resampling functions used for solving the model (both log-linear and with arbitrary policy functions). -
NK_saving_plotting– Functions for saving IRF results to CSV and plotting IRFs. -
params– Parameter setup module. -
NK_utils– Additional helper functions.
The NK model is solved in four main steps:
-
Simulate the initial grid
Generate a grid over ((k, v, z)) using the log-linearized model. -
Deterministic model solution
Solve the deterministic version of the New Keynesian model using the initial grid. -
New grid simulation
Simulate a new grid based on the policy rules from the deterministic solution. -
Full stochastic solution
Solve the full (stochastic) version of the model on the new grid, with adaptive refinements.