diff --git a/src/MacroModelling.jl b/src/MacroModelling.jl index 0dc90d5b..92b16a44 100644 --- a/src/MacroModelling.jl +++ b/src/MacroModelling.jl @@ -5228,79 +5228,79 @@ end -# @setup_workload begin -# # Putting some things in `setup` can reduce the size of the -# # precompile file and potentially make loading faster. -# @model FS2000 precompile = true begin -# dA[0] = exp(gam + z_e_a * e_a[x]) -# log(m[0]) = (1 - rho) * log(mst) + rho * log(m[-1]) + z_e_m * e_m[x] -# - P[0] / (c[1] * P[1] * m[0]) + bet * P[1] * (alp * exp( - alp * (gam + log(e[1]))) * k[0] ^ (alp - 1) * n[1] ^ (1 - alp) + (1 - del) * exp( - (gam + log(e[1])))) / (c[2] * P[2] * m[1])=0 -# W[0] = l[0] / n[0] -# - (psi / (1 - psi)) * (c[0] * P[0] / (1 - n[0])) + l[0] / n[0] = 0 -# R[0] = P[0] * (1 - alp) * exp( - alp * (gam + z_e_a * e_a[x])) * k[-1] ^ alp * n[0] ^ ( - alp) / W[0] -# 1 / (c[0] * P[0]) - bet * P[0] * (1 - alp) * exp( - alp * (gam + z_e_a * e_a[x])) * k[-1] ^ alp * n[0] ^ (1 - alp) / (m[0] * l[0] * c[1] * P[1]) = 0 -# c[0] + k[0] = exp( - alp * (gam + z_e_a * e_a[x])) * k[-1] ^ alp * n[0] ^ (1 - alp) + (1 - del) * exp( - (gam + z_e_a * e_a[x])) * k[-1] -# P[0] * c[0] = m[0] -# m[0] - 1 + d[0] = l[0] -# e[0] = exp(z_e_a * e_a[x]) -# y[0] = k[-1] ^ alp * n[0] ^ (1 - alp) * exp( - alp * (gam + z_e_a * e_a[x])) -# gy_obs[0] = dA[0] * y[0] / y[-1] -# gp_obs[0] = (P[0] / P[-1]) * m[-1] / dA[0] -# log_gy_obs[0] = log(gy_obs[0]) -# log_gp_obs[0] = log(gp_obs[0]) -# end +@setup_workload begin + # Putting some things in `setup` can reduce the size of the + # precompile file and potentially make loading faster. + @model FS2000 precompile = true begin + dA[0] = exp(gam + z_e_a * e_a[x]) + log(m[0]) = (1 - rho) * log(mst) + rho * log(m[-1]) + z_e_m * e_m[x] + - P[0] / (c[1] * P[1] * m[0]) + bet * P[1] * (alp * exp( - alp * (gam + log(e[1]))) * k[0] ^ (alp - 1) * n[1] ^ (1 - alp) + (1 - del) * exp( - (gam + log(e[1])))) / (c[2] * P[2] * m[1])=0 + W[0] = l[0] / n[0] + - (psi / (1 - psi)) * (c[0] * P[0] / (1 - n[0])) + l[0] / n[0] = 0 + R[0] = P[0] * (1 - alp) * exp( - alp * (gam + z_e_a * e_a[x])) * k[-1] ^ alp * n[0] ^ ( - alp) / W[0] + 1 / (c[0] * P[0]) - bet * P[0] * (1 - alp) * exp( - alp * (gam + z_e_a * e_a[x])) * k[-1] ^ alp * n[0] ^ (1 - alp) / (m[0] * l[0] * c[1] * P[1]) = 0 + c[0] + k[0] = exp( - alp * (gam + z_e_a * e_a[x])) * k[-1] ^ alp * n[0] ^ (1 - alp) + (1 - del) * exp( - (gam + z_e_a * e_a[x])) * k[-1] + P[0] * c[0] = m[0] + m[0] - 1 + d[0] = l[0] + e[0] = exp(z_e_a * e_a[x]) + y[0] = k[-1] ^ alp * n[0] ^ (1 - alp) * exp( - alp * (gam + z_e_a * e_a[x])) + gy_obs[0] = dA[0] * y[0] / y[-1] + gp_obs[0] = (P[0] / P[-1]) * m[-1] / dA[0] + log_gy_obs[0] = log(gy_obs[0]) + log_gp_obs[0] = log(gp_obs[0]) + end -# @parameters FS2000 silent = true precompile = true begin -# alp = 0.356 -# bet = 0.993 -# gam = 0.0085 -# mst = 1.0002 -# rho = 0.129 -# psi = 0.65 -# del = 0.01 -# z_e_a = 0.035449 -# z_e_m = 0.008862 -# end + @parameters FS2000 silent = true precompile = true begin + alp = 0.356 + bet = 0.993 + gam = 0.0085 + mst = 1.0002 + rho = 0.129 + psi = 0.65 + del = 0.01 + z_e_a = 0.035449 + z_e_m = 0.008862 + end -# ENV["GKSwstype"] = "nul" - -# @compile_workload begin -# # all calls in this block will be precompiled, regardless of whether -# # they belong to your package or not (on Julia 1.8 and higher) -# @model RBC precompile = true begin -# 1 / c[0] = (0.95 / c[1]) * (α * exp(z[1]) * k[0]^(α - 1) + (1 - δ)) -# c[0] + k[0] = (1 - δ) * k[-1] + exp(z[0]) * k[-1]^α -# z[0] = 0.2 * z[-1] + 0.01 * eps_z[x] -# end + ENV["GKSwstype"] = "nul" + + @compile_workload begin + # all calls in this block will be precompiled, regardless of whether + # they belong to your package or not (on Julia 1.8 and higher) + @model RBC precompile = true begin + 1 / c[0] = (0.95 / c[1]) * (α * exp(z[1]) * k[0]^(α - 1) + (1 - δ)) + c[0] + k[0] = (1 - δ) * k[-1] + exp(z[0]) * k[-1]^α + z[0] = 0.2 * z[-1] + 0.01 * eps_z[x] + end -# @parameters RBC silent = true precompile = true begin -# δ = 0.02 -# α = 0.5 -# end + @parameters RBC silent = true precompile = true begin + δ = 0.02 + α = 0.5 + end -# get_SS(FS2000) -# get_SS(FS2000, parameters = :alp => 0.36) -# get_solution(FS2000) -# get_solution(FS2000, parameters = :alp => 0.35) -# get_standard_deviation(FS2000) -# get_correlation(FS2000) -# get_autocorrelation(FS2000) -# get_variance_decomposition(FS2000) -# get_conditional_variance_decomposition(FS2000) -# get_irf(FS2000) - -# data = simulate(FS2000)[:,:,1] -# observables = [:c,:k] -# calculate_kalman_filter_loglikelihood(FS2000, data(observables), observables) -# get_mean(FS2000, silent = true) -# get_SSS(FS2000, silent = true) -# # get_SSS(FS2000, algorithm = :third_order, silent = true) - -# # import Plots, StatsPlots -# # plot_irf(FS2000) -# # plot_solution(FS2000,:k) # fix warning when there is no sensitivity and all values are the same. triggers: no strict ticks found... -# # plot_conditional_variance_decomposition(FS2000) -# end -# end + get_SS(FS2000) + get_SS(FS2000, parameters = :alp => 0.36) + get_solution(FS2000) + get_solution(FS2000, parameters = :alp => 0.35) + get_standard_deviation(FS2000) + get_correlation(FS2000) + get_autocorrelation(FS2000) + get_variance_decomposition(FS2000) + get_conditional_variance_decomposition(FS2000) + get_irf(FS2000) + + data = simulate(FS2000)[:,:,1] + observables = [:c,:k] + calculate_kalman_filter_loglikelihood(FS2000, data(observables), observables) + get_mean(FS2000, silent = true) + get_SSS(FS2000, silent = true) + # get_SSS(FS2000, algorithm = :third_order, silent = true) + + # import Plots, StatsPlots + # plot_irf(FS2000) + # plot_solution(FS2000,:k) # fix warning when there is no sensitivity and all values are the same. triggers: no strict ticks found... + # plot_conditional_variance_decomposition(FS2000) + end +end end