Skip to content

Commit

Permalink
Merge branch 'main' into cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
thorek1 authored Nov 23, 2023
2 parents 58752f4 + e619aae commit 2132603
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/src/how-to/obc.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Let's check out the non stochastic steady state (NSSS):

```@repl howto_obc
SS(Gali_2015_chapter_3_obc)
SS(Gali_2015_chapter_3_obc)(:R)
```

There are a few things to note here. First, we get the NSSS values of the auxilliary variables related to the occasionally binding constraint. Second, the NSSS value of `R` is 1, and thereby the effective lower bound is binding in the NSSS. While this is a viable NSSS it is not a viable approximation point for perturbation. We can only find a perturbation solution if the effective lower bound is not binding in NSSS. Calling `get_solution` reveals that there is no stable solution at this NSSS:
Expand Down Expand Up @@ -226,6 +227,7 @@ and check the NSSS once more:

```@repl howto_obc
SS(Gali_2015_chapter_3_obc)
SS(Gali_2015_chapter_3_obc)(:R)
```

Now we get `R > R̄`, so that the constraint is not binding in the NSSS and we can work with a stable first order solution:
Expand Down Expand Up @@ -317,12 +319,14 @@ Compare this to the theoretical mean of the model without the occasionally bindi

```@repl howto_obc
get_mean(Gali_2015_chapter_3_obc)
get_mean(Gali_2015_chapter_3_obc)(:Y)
```

and the theoretical standard deviation:

```@repl howto_obc
get_std(Gali_2015_chapter_3_obc)
get_std(Gali_2015_chapter_3_obc)(:Y)
```

The mean of output is lower in the model with effective lower bound compared to the model without and the standard deviation is higher.
Expand Down
1 change: 1 addition & 0 deletions docs/src/unfinished_docs/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## High priority

- [ ] add technical details about SS solver, obc solver, and other algorithms
- [ ] fix translate dynare mod file from file written using write to dynare file (see test models)
- [ ] rm obc vars from get_SS
- [ ] fix SS solver (failed for backus in guide)
- [ ] functions to reverse state_update (input: previous shock and current state, output previous state), find shocks corresponding to bringing one state to the next
Expand Down
14 changes: 14 additions & 0 deletions test/test_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ if !test_higher_order
@test isapprox(var_dec(["K{F}","Y{H}","Z{F}"],"E{H}") * 100, [48.66, 57.56, 47.41],rtol = 1e-3)

write_to_dynare_file(Backus_Kehoe_Kydland_1992)
translate_dynare_file("Backus_Kehoe_Kydland_1992.mod")
Backus_Kehoe_Kydland_1992 = nothing


Expand All @@ -25,6 +26,7 @@ if !test_higher_order
@test isapprox(var_dec(:US_K,[:EA_EPSRP,:US_EPSR,:US_EPSZ]) * 100, [17.48, 26.83, 27.76],rtol = 1e-3)

write_to_dynare_file(NAWM_EAUS_2008)
translate_dynare_file("NAWM_EAUS_2008.mod")
NAWM_EAUS_2008 = nothing


Expand All @@ -41,6 +43,7 @@ if !test_higher_order
@test isapprox(corrr(:r,:w),-0.9898,rtol = 1e-3)

write_to_dynare_file(Baxter_King_1993)
translate_dynare_file("Baxter_King_1993.mod")
Baxter_King_1993 = nothing


Expand All @@ -54,6 +57,7 @@ if !test_higher_order
@test isapprox(var_dec(:π̂,:) * 100, [4.51, 0.91, 87.44, 7.14],rtol = 1e-4)

write_to_dynare_file(Ireland_2004)
translate_dynare_file("Ireland_2004.mod")
Ireland_2004 = nothing


Expand All @@ -69,6 +73,7 @@ if !test_higher_order
@test isapprox(var_dec(:E_BGYN,:) * 100, [3.00, 0.23, 0.54, 0.01, 0.08, 0.38, 0.14, 0.10, 83.60, 3.28, 1.11, 3.36, 0.01, 1.56, 0.17, 0.17, 0.00, 2.24, 0.01], rtol = 1e-3)

write_to_dynare_file(QUEST3_2009)
# translate_dynare_file("QUEST3_2009.mod") # fix BGADJ1 = 0.001BGADJ2;
QUEST3_2009 = nothing


Expand All @@ -84,6 +89,7 @@ if !test_higher_order
@test isapprox(var_dec(:B,:) * 100, [42.97, 19.31, 11.70, 0.36, 4.45, 1.41, 0.70, 0.00, 0.61, 12.54, 2.85, 2.72, 0.38],rtol = 1e-3)

write_to_dynare_file(GNSS_2010)
translate_dynare_file("GNSS_2010.mod")
GNSS_2010 = nothing


Expand All @@ -98,6 +104,7 @@ if !test_higher_order
@test isapprox(var_dec(:x,:) * 100, [56.22, 43.78],rtol = 1e-3)

write_to_dynare_file(Gali_Monacelli_2005_CITR)
translate_dynare_file("Gali_Monacelli_2005_CITR.mod")
Gali_Monacelli_2005_CITR = nothing


Expand All @@ -112,6 +119,7 @@ if !test_higher_order
@test isapprox(var_dec(:y,:) * 100, [0.47, 99.41, 0.12],rtol = 1e-3)

write_to_dynare_file(Ascari_Sbordone_2014)
translate_dynare_file("Ascari_Sbordone_2014.mod")
Ascari_Sbordone_2014 = nothing

end
Expand All @@ -135,6 +143,7 @@ if test_higher_order
end

write_to_dynare_file(SGU_2003_debt_premium)
translate_dynare_file("SGU_2003_debt_premium.mod")
SGU_2003_debt_premium = nothing


Expand All @@ -159,6 +168,7 @@ if test_higher_order
end

write_to_dynare_file(JQ_2012_RBC)
translate_dynare_file("JQ_2012_RBC.mod")
JQ_2012_RBC = nothing


Expand Down Expand Up @@ -186,6 +196,7 @@ if test_higher_order
end

write_to_dynare_file(Ghironi_Melitz_2005)
translate_dynare_file("Ghironi_Melitz_2005.mod")
Ghironi_Melitz_2005 = nothing


Expand All @@ -211,6 +222,7 @@ if test_higher_order
end

write_to_dynare_file(Gali_2015_chapter_3_nonlinear)
translate_dynare_file("Gali_2015_chapter_3_nonlinear.mod")
Gali_2015_chapter_3_nonlinear = nothing


Expand All @@ -230,6 +242,7 @@ if test_higher_order
end

write_to_dynare_file(Caldara_et_al_2012)
translate_dynare_file("Caldara_et_al_2012.mod")
Caldara_et_al_2012 = nothing


Expand All @@ -255,4 +268,5 @@ if test_higher_order
end

write_to_dynare_file(Aguiar_Gopinath_2007)
translate_dynare_file("Aguiar_Gopinath_2007.mod")
Aguiar_Gopinath_2007 = nothing

0 comments on commit 2132603

Please sign in to comment.