Title: | Bringing the Power of 'Dynare' to 'R', 'R Markdown', and 'Quarto' |
---|---|
Description: | It allows running 'Dynare' program from base R, R Markdown and Quarto. 'Dynare' is a software platform for handling a wide class of economic models, in particular dynamic stochastic general equilibrium ('DSGE') and overlapping generations ('OLG') models. This package does not only integrate R and Dynare but also serves as a 'Dynare' Knit-Engine for 'knitr' package. The package requires 'Dynare' (<https://www.dynare.org/>) and 'Octave' (<https://www.octave.org/download.html>). Write all your 'Dynare' commands in R or R Markdown chunk. |
Authors: | Sagiru Mati [aut, cre] |
Maintainer: | Sagiru Mati <[email protected]> |
License: | GPL |
Version: | 0.1.5 |
Built: | 2024-10-27 12:31:12 UTC |
Source: | CRAN |
It allows running 'Dynare' program from base R, R Markdown and Quarto. 'Dynare' is a software platform for handling a wide class of economic models, in particular dynamic stochastic general equilibrium ('DSGE') and overlapping generations ('OLG') models. This package does not only integrate R and Dynare but also serves as a 'Dynare' Knit-Engine for 'knitr' package. The package requires 'Dynare' (https://www.dynare.org/) and 'Octave' (https://www.octave.org/download.html). Write all your 'Dynare' commands in R or R Markdown chunk.
Maintainer: Sagiru Mati [email protected] (ORCID)
Useful links:
Report bugs at https://github.com/sagirumati/DynareR/issues
Other important functions:
add_matlab_path()
,
add_path()
,
eng_dynare()
,
import_log()
,
include_IRF()
,
input_tex()
,
run_dynare()
,
run_models()
,
set_dynare_version()
,
set_matlab_path()
,
set_octave_path()
,
write_dyn()
,
write_mod()
Octave's
addpath
to add matlab
folder.Use this function to add matlab
folder.
Use this function if Dynare
is NOT installed in the standard location
add_matlab_path(matlab_path)
add_matlab_path(matlab_path)
matlab_path |
Path to the |
Set of Dynare
(open-source software for DSGE modelling) outputs
Other important functions:
DynareR-package
,
add_path()
,
eng_dynare()
,
import_log()
,
include_IRF()
,
input_tex()
,
run_dynare()
,
run_models()
,
set_dynare_version()
,
set_matlab_path()
,
set_octave_path()
,
write_dyn()
,
write_mod()
library(DynareR) ## Not run: add_matlab_path('/usr/lib/dynare/matlab') # Default for Linux add_matlab_path('c:/dynare/5.1/matlab') # Default for Windows, but 5.1 can change # if later version of `Dynare` is installed. add_matlab_path('/usr/lib/dynare/matlab') # Default for macOS ## End(Not run)
library(DynareR) ## Not run: add_matlab_path('/usr/lib/dynare/matlab') # Default for Linux add_matlab_path('c:/dynare/5.1/matlab') # Default for Windows, but 5.1 can change # if later version of `Dynare` is installed. add_matlab_path('/usr/lib/dynare/matlab') # Default for macOS ## End(Not run)
Octave's
addpath
to add matlab
folder.Use this function to add matlab
folder.
Use this function if Dynare
is NOT installed in the standard location
add_path(path)
add_path(path)
path |
Path to the |
Set of Dynare
(open-source software for DSGE modelling) outputs
Other important functions:
DynareR-package
,
add_matlab_path()
,
eng_dynare()
,
import_log()
,
include_IRF()
,
input_tex()
,
run_dynare()
,
run_models()
,
set_dynare_version()
,
set_matlab_path()
,
set_octave_path()
,
write_dyn()
,
write_mod()
library(DynareR) ## Not run: add_path('/usr/lib/dynare/matlab') # Default for Linux add_path('c:/dynare/5.1/matlab') # Default for Windows, but 5.1 can change if later version of # `Dynare` is installed. add_path('/usr/lib/dynare/matlab') # Default for macOS ## End(Not run)
library(DynareR) ## Not run: add_path('/usr/lib/dynare/matlab') # Default for Linux add_path('c:/dynare/5.1/matlab') # Default for Windows, but 5.1 can change if later version of # `Dynare` is installed. add_path('/usr/lib/dynare/matlab') # Default for macOS ## End(Not run)
This package runs on top of knitr to facilitate communication with Dynare. Run Dynare scripts from R Markdown document.
eng_dynare(options)
eng_dynare(options)
options |
Chunk options, as provided by |
The dynare
engine can be activated via
knitr::knit_engines$set(dynare = DynareR::eng_dynare)
This will be set within an R Markdown document's setup chunk.
Set of Dynare
(open-source software for DSGE modelling) codes
Sagiru Mati, ORCID: 0000-0003-1413-3974, https://smati.com.ng
Yusuf Maitama Sule (Northwest) University Kano, Nigeria
SMATI Academy
Mati S. 2020a. “DynareR: Bringing the Power of Dynare to R, R Markdown, and Quarto.” CRAN. https://CRAN.R-project.org/package=DynareR.
Mati S. 2020b. EviewsR: A Seamless Integration of EViews and R. https://CRAN.R-project.org/package=EviewsR.
Mati S. 2020c. gretlR: A Seamless Integration of Gretl and R. https://CRAN.R-project.org/package=gretlR.
Mati S. 2023a. URooTab: Tabular Reporting of EViews Unit Root Tests. https://CRAN.R-project.org/package=URooTab.
Mati S, Civcir I., and Abba S. I. 2023. “EviewsR: An r Package for Dynamic and Reproducible Research Using EViews, r, r Markdown and Quarto.” The R Journal 15 (2): 169–205. doi:10.32614/rj-2023-045.
Bob Rudis (2015).Running Go language chunks in R Markdown (Rmd) files. Available at: https://gist.github.com/hrbrmstr/9accf90e63d852337cb7
Yihui Xie (2019). knitr: A General-Purpose Package for Dynamic Report Generation in R. R package version 1.24.
Yihui Xie (2015) Dynamic Documents with R and knitr. 2nd edition. Chapman and Hall/CRC. ISBN 978-1498716963
Yihui Xie (2014) knitr: A Comprehensive Tool for Reproducible Research in R. In Victoria Stodden, Friedrich Leisch and Roger D. Peng, editors, Implementing Reproducible Computational Research. Chapman and Hall/CRC. ISBN 978-1466561595
Other important functions:
DynareR-package
,
add_matlab_path()
,
add_path()
,
import_log()
,
include_IRF()
,
input_tex()
,
run_dynare()
,
run_models()
,
set_dynare_version()
,
set_matlab_path()
,
set_octave_path()
,
write_dyn()
,
write_mod()
knitr::knit_engines$set(dynare = DynareR::eng_dynare) library(DynareR)
knitr::knit_engines$set(dynare = DynareR::eng_dynare) library(DynareR)
dynare
log file as a list of R dataframes.Use this function to import dynare
log file as a list of R dataframes.
The imported list can be accessed via dynare$modelNmae
.
import_log(path = ".", model = "")
import_log(path = ".", model = "")
path |
A character string for the path to the |
model |
Object or a character string representing the name of the |
Set of Dynare
(open-source software for DSGE modelling) outputs
Other important functions:
DynareR-package
,
add_matlab_path()
,
add_path()
,
eng_dynare()
,
include_IRF()
,
input_tex()
,
run_dynare()
,
run_models()
,
set_dynare_version()
,
set_matlab_path()
,
set_octave_path()
,
write_dyn()
,
write_mod()
## Not run: library(DynareR) demo(bkk) import_log(model="bkk") # Alternatively, use the path to the log file import_log(path="bkk/bkk.log") # Access the mported list dynare$bkk dynare$bkk$moments knitr::kable(dynare$bkk$decomposition,format='pandoc') ## End(Not run)
## Not run: library(DynareR) demo(bkk) import_log(model="bkk") # Alternatively, use the path to the log file import_log(path="bkk/bkk.log") # Access the mported list dynare$bkk dynare$bkk$moments knitr::kable(dynare$bkk$decomposition,format='pandoc') ## End(Not run)
Use this function to include Dynare
IRF into the R Markdown document
include_IRF(path = ".", model = "", IRF = "", crop = TRUE)
include_IRF(path = ".", model = "", IRF = "", crop = TRUE)
path |
A character string for the path to the IRF graph. |
model |
Object or a character string representing the name of the |
IRF |
A character string for the name of the Impulse Response Function as defined in the |
crop |
Whether to crop the white space around the graph |
Set of Dynare
(open-source software for DSGE modelling) outputs
Sagiru Mati, ORCID: 0000-0003-1413-3974
Yusuf Maitama Sule (Northwest) University Kano, Nigeria
SMATI Academy
Bob Rudis (2015).Running Go language chunks in R Markdown (Rmd) files. Available at: https://gist.github.com/hrbrmstr/9accf90e63d852337cb7
Yihui Xie (2019). knitr: A General-Purpose Package for Dynamic Report Generation in R. R package version 1.24.
Yihui Xie (2015) Dynamic Documents with R and knitr. 2nd edition. Chapman and Hall/CRC. ISBN 978-1498716963
Yihui Xie (2014) knitr: A Comprehensive Tool for Reproducible Research in R. In Victoria Stodden, Friedrich Leisch and Roger D. Peng, editors, Implementing Reproducible Computational Research. Chapman and Hall/CRC. ISBN 978-1466561595
Other important functions:
DynareR-package
,
add_matlab_path()
,
add_path()
,
eng_dynare()
,
import_log()
,
input_tex()
,
run_dynare()
,
run_models()
,
set_dynare_version()
,
set_matlab_path()
,
set_octave_path()
,
write_dyn()
,
write_mod()
## Not run: library(DynareR) demo(bkk) include_IRF(model="bkk",IRF="E_H2") # The above code fetches the IRF graph from "bkk/bkk/graphs/bkk_IRF_E_H2.pdf" # Alternatively, the `path` argument can be used as follows include_IRF(path="bkk/bkk/graphs/bkk_IRF_E_H2.pdf") ## End(Not run)
## Not run: library(DynareR) demo(bkk) include_IRF(model="bkk",IRF="E_H2") # The above code fetches the IRF graph from "bkk/bkk/graphs/bkk_IRF_E_H2.pdf" # Alternatively, the `path` argument can be used as follows include_IRF(path="bkk/bkk/graphs/bkk_IRF_E_H2.pdf") ## End(Not run)
Use this function to include TeX file in R Markdown or Quarto document.
input_tex(path, start = NA, end = NA)
input_tex(path, start = NA, end = NA)
path |
Object or a character string representing the path to the |
start |
Numeric. The start line(s) of the |
end |
Numeric. The last line(s) of the |
Set of TeX
text
Other important functions:
DynareR-package
,
add_matlab_path()
,
add_path()
,
eng_dynare()
,
import_log()
,
include_IRF()
,
run_dynare()
,
run_models()
,
set_dynare_version()
,
set_matlab_path()
,
set_octave_path()
,
write_dyn()
,
write_mod()
library(DynareR) ## Not run: input_tex("DynareR/TeXFolder/olsTable.tex") ## End(Not run)
library(DynareR) ## Not run: input_tex("DynareR/TeXFolder/olsTable.tex") ## End(Not run)
Dynare
mod
fileUse this function to create and run Dynare
mod
file.
Use run_dynare(code="someCode",model="someModel")
if you want the Dynare
files to live in the current working directory.
Use run_dynare(run_dynare(code="someCode",model="someDirectory/someModel"))
if you want the Dynare
files to live in the path different from the current working directory (for example, someDirectory
).
run_dynare(code, model, import_log = FALSE)
run_dynare(code, model, import_log = FALSE)
code |
Object or a character string representing the set of |
model |
Object or a character string representing the name of the |
import_log |
Logical. Whether or not to import |
Set of Dynare
(open-source software for DSGE modelling) outputs
Other important functions:
DynareR-package
,
add_matlab_path()
,
add_path()
,
eng_dynare()
,
import_log()
,
include_IRF()
,
input_tex()
,
run_models()
,
set_dynare_version()
,
set_matlab_path()
,
set_octave_path()
,
write_dyn()
,
write_mod()
library(DynareR) ## Not run: DynareCodes='var y, c, k, a, h, b; varexo e, u; parameters beta, rho, alpha, delta, theta, psi, tau; alpha = 0.36; rho = 0.95; tau = 0.025; beta = 0.99; delta = 0.025; psi = 0; theta = 2.95; phi = 0.1; model; c*theta*h^(1+psi)=(1-alpha)*y; k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); k = exp(b)*(y-c)+(1-delta)*k(-1); a = rho*a(-1)+tau*b(-1) + e; b = tau*a(-1)+rho*b(-1) + u; end; initval; y = 1.08068253095672; c = 0.80359242014163; h = 0.29175631001732; k = 11.08360443260358; a = 0; b = 0; e = 0; u = 0; end; shocks; var e; stderr 0.009; var u; stderr 0.009; var e, u = phi*0.009*0.009; end; stoch_simul;' # This is "example1" of the `Dynare` example files executed in current working directory run_dynare(code=DynareCodes,model="example1",import_log=T) # import_log=T returns the `dynare` log file as a list of dataframes in an environment `dynare`, # which can be accessed using `dynare$modelName` dynare$example1 dynare$example1$correlations dynare$example1$autocorrelation[4,3] knitr::kable(dynare$example1$moments,format='pandoc') # This is "example1" of the `Dynare` example files executed in "DynareR/run_dynare/" folder run_dynare(code=DynareCodes,model="DynareR/run_dynare/example1") ## End(Not run)
library(DynareR) ## Not run: DynareCodes='var y, c, k, a, h, b; varexo e, u; parameters beta, rho, alpha, delta, theta, psi, tau; alpha = 0.36; rho = 0.95; tau = 0.025; beta = 0.99; delta = 0.025; psi = 0; theta = 2.95; phi = 0.1; model; c*theta*h^(1+psi)=(1-alpha)*y; k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); k = exp(b)*(y-c)+(1-delta)*k(-1); a = rho*a(-1)+tau*b(-1) + e; b = tau*a(-1)+rho*b(-1) + u; end; initval; y = 1.08068253095672; c = 0.80359242014163; h = 0.29175631001732; k = 11.08360443260358; a = 0; b = 0; e = 0; u = 0; end; shocks; var e; stderr 0.009; var u; stderr 0.009; var e, u = phi*0.009*0.009; end; stoch_simul;' # This is "example1" of the `Dynare` example files executed in current working directory run_dynare(code=DynareCodes,model="example1",import_log=T) # import_log=T returns the `dynare` log file as a list of dataframes in an environment `dynare`, # which can be accessed using `dynare$modelName` dynare$example1 dynare$example1$correlations dynare$example1$autocorrelation[4,3] knitr::kable(dynare$example1$moments,format='pandoc') # This is "example1" of the `Dynare` example files executed in "DynareR/run_dynare/" folder run_dynare(code=DynareCodes,model="DynareR/run_dynare/example1") ## End(Not run)
mod
or dyn
files.Use this function to execute multiple existing Dynare
files.
Use run_models(model='someModel')
if the Dynare files live in the current working directory.
Use run_models(model='someDirectory/someModel')
if the Dynare files live in the path different from the current working directory (for example, someDirectory
).
run_models(model = "*", import_log = FALSE)
run_models(model = "*", import_log = FALSE)
model |
Object or a vector of character strings representing the names of the |
import_log |
Logical. Whether or not to import |
Set of Dynare
(open-source software for DSGE modelling) outputs
Other important functions:
DynareR-package
,
add_matlab_path()
,
add_path()
,
eng_dynare()
,
import_log()
,
include_IRF()
,
input_tex()
,
run_dynare()
,
set_dynare_version()
,
set_matlab_path()
,
set_octave_path()
,
write_dyn()
,
write_mod()
library(DynareR) ## Not run: demo(agtrend) demo(bkk) demo(example1) # Provide the list of the `Dynare` files in a vector # Ensure that "agtrend.mod", "bkk.mod" and "example1.mod" # live in the current working directory # Copy the dynare files to the current working directory lapply(c("agtrend","bkk","example1"),\(x) file.copy(paste0(x,"/",x,".mod"),".")) run_models(c("agtrend","bkk","example1")) # Run the models in the vector. run_models() # Run all models in Current Working Directory. # You can run all models that live in "DynareR/run_dynare/" folder # Copy the dynare files to the 'DynareR/run_dynare' directory lapply(c("agtrend","bkk","example1"),\(x) file.copy(paste0(x,".mod"),"DynareR/run_dynare")) run_models("DynareR/run_dynare*") # Note the * at the end. ## End(Not run)
library(DynareR) ## Not run: demo(agtrend) demo(bkk) demo(example1) # Provide the list of the `Dynare` files in a vector # Ensure that "agtrend.mod", "bkk.mod" and "example1.mod" # live in the current working directory # Copy the dynare files to the current working directory lapply(c("agtrend","bkk","example1"),\(x) file.copy(paste0(x,"/",x,".mod"),".")) run_models(c("agtrend","bkk","example1")) # Run the models in the vector. run_models() # Run all models in Current Working Directory. # You can run all models that live in "DynareR/run_dynare/" folder # Copy the dynare files to the 'DynareR/run_dynare' directory lapply(c("agtrend","bkk","example1"),\(x) file.copy(paste0(x,".mod"),"DynareR/run_dynare")) run_models("DynareR/run_dynare*") # Note the * at the end. ## End(Not run)
Dynare
versionUse this function to set Dynare
version
set_dynare_version(dynare_version="")
set_dynare_version(dynare_version="")
dynare_version |
Character representing |
Character
Other important functions:
DynareR-package
,
add_matlab_path()
,
add_path()
,
eng_dynare()
,
import_log()
,
include_IRF()
,
input_tex()
,
run_dynare()
,
run_models()
,
set_matlab_path()
,
set_octave_path()
,
write_dyn()
,
write_mod()
library(DynareR) ## Not run: # If you want to use the development version of Dynare set_dynare_version("6-unstable-2022-04-03-0800-700a0e3a") # The development version of Dynare # If you want to use Dynare version 5.2 set_dynare_version("5.2") ## End(Not run)
library(DynareR) ## Not run: # If you want to use the development version of Dynare set_dynare_version("6-unstable-2022-04-03-0800-700a0e3a") # The development version of Dynare # If you want to use Dynare version 5.2 set_dynare_version("5.2") ## End(Not run)
Matlab
pathUse this function to set Matlab
path
set_matlab_path(matlab_path = "matlab")
set_matlab_path(matlab_path = "matlab")
matlab_path |
Path to the Matlab executable. This overwrites |
Character
Other important functions:
DynareR-package
,
add_matlab_path()
,
add_path()
,
eng_dynare()
,
import_log()
,
include_IRF()
,
input_tex()
,
run_dynare()
,
run_models()
,
set_dynare_version()
,
set_octave_path()
,
write_dyn()
,
write_mod()
library(DynareR) ## Not run: set_matlab_path('C:/Program Files/MATLAB/R2024a/bin/matlab') ## End(Not run)
library(DynareR) ## Not run: set_matlab_path('C:/Program Files/MATLAB/R2024a/bin/matlab') ## End(Not run)
Octave
pathUse this function to set Octave
path
set_octave_path(octave_path = "octave")
set_octave_path(octave_path = "octave")
octave_path |
Path to the Octave executable |
Character
Other important functions:
DynareR-package
,
add_matlab_path()
,
add_path()
,
eng_dynare()
,
import_log()
,
include_IRF()
,
input_tex()
,
run_dynare()
,
run_models()
,
set_dynare_version()
,
set_matlab_path()
,
write_dyn()
,
write_mod()
library(DynareR) ## Not run: set_octave_path('C:/Program Files/GNU Octave/Octave-6.4.0/mingw64/bin/octave20.exe') ## End(Not run)
library(DynareR) ## Not run: set_octave_path('C:/Program Files/GNU Octave/Octave-6.4.0/mingw64/bin/octave20.exe') ## End(Not run)
dyn
file.Use write_dyn(code="someCode",model="someModel")
if you want the Dynare
file to live in the current working directory.
Use write_dyn(code="someCode",model="someDirectory/someModel")
if you want the Dynare
file to live in the path different from the current working directory (for example, someDirectory
).
write_dyn(code, model)
write_dyn(code, model)
code |
Object or a character string representing the set of |
model |
Object or a character string representing the name of the |
Set of Dynare
(open-source software for DSGE modelling) outputs
Other important functions:
DynareR-package
,
add_matlab_path()
,
add_path()
,
eng_dynare()
,
import_log()
,
include_IRF()
,
input_tex()
,
run_dynare()
,
run_models()
,
set_dynare_version()
,
set_matlab_path()
,
set_octave_path()
,
write_mod()
library(DynareR) ## Not run: dynareCodes='var y, c, k, a, h, b; varexo e, u; parameters beta, rho, alpha, delta, theta, psi, tau; alpha = 0.36; rho = 0.95; tau = 0.025; beta = 0.99; delta = 0.025; psi = 0; theta = 2.95; phi = 0.1; model; c*theta*h^(1+psi)=(1-alpha)*y; k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); k = exp(b)*(y-c)+(1-delta)*k(-1); a = rho*a(-1)+tau*b(-1) + e; b = tau*a(-1)+rho*b(-1) + u; end; initval; y = 1.08068253095672; c = 0.80359242014163; h = 0.29175631001732; k = 11.08360443260358; a = 0; b = 0; e = 0; u = 0; end; shocks; var e; stderr 0.009; var u; stderr 0.009; var e, u = phi*0.009*0.009; end; stoch_simul;' # This writes "example1" of the `Dynare` example with dyn extension write_dyn(code=dynareCodes,model="example1") # This writes "example1" of the `Dynare` example with dyn extension in "DynareR/write_dyn" folder write_dyn(code=dynareCodes,model="DynareR/write_dyn/example1") ## End(Not run)
library(DynareR) ## Not run: dynareCodes='var y, c, k, a, h, b; varexo e, u; parameters beta, rho, alpha, delta, theta, psi, tau; alpha = 0.36; rho = 0.95; tau = 0.025; beta = 0.99; delta = 0.025; psi = 0; theta = 2.95; phi = 0.1; model; c*theta*h^(1+psi)=(1-alpha)*y; k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); k = exp(b)*(y-c)+(1-delta)*k(-1); a = rho*a(-1)+tau*b(-1) + e; b = tau*a(-1)+rho*b(-1) + u; end; initval; y = 1.08068253095672; c = 0.80359242014163; h = 0.29175631001732; k = 11.08360443260358; a = 0; b = 0; e = 0; u = 0; end; shocks; var e; stderr 0.009; var u; stderr 0.009; var e, u = phi*0.009*0.009; end; stoch_simul;' # This writes "example1" of the `Dynare` example with dyn extension write_dyn(code=dynareCodes,model="example1") # This writes "example1" of the `Dynare` example with dyn extension in "DynareR/write_dyn" folder write_dyn(code=dynareCodes,model="DynareR/write_dyn/example1") ## End(Not run)
mod
file.Use write_mod(code="someCode",model="someModel")
if you want the Dynare
file to live in the current working directory.
Use write_mod(code="someCode",model="someDirectory/someModel")
if you want the Dynare
file to live in the path different from the current working directory (for example, someDirectory
).
write_mod(code, model)
write_mod(code, model)
code |
Object or a character string representing the set of |
model |
Object or a character string representing the name of the |
Set of Dynare
(open-source software for DSGE modelling) outputs
Other important functions:
DynareR-package
,
add_matlab_path()
,
add_path()
,
eng_dynare()
,
import_log()
,
include_IRF()
,
input_tex()
,
run_dynare()
,
run_models()
,
set_dynare_version()
,
set_matlab_path()
,
set_octave_path()
,
write_dyn()
library(DynareR) ## Not run: dynareCodes='var y, c, k, a, h, b; varexo e, u; parameters beta, rho, alpha, delta, theta, psi, tau; alpha = 0.36; rho = 0.95; tau = 0.025; beta = 0.99; delta = 0.025; psi = 0; theta = 2.95; phi = 0.1; model; c*theta*h^(1+psi)=(1-alpha)*y; k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); k = exp(b)*(y-c)+(1-delta)*k(-1); a = rho*a(-1)+tau*b(-1) + e; b = tau*a(-1)+rho*b(-1) + u; end; initval; y = 1.08068253095672; c = 0.80359242014163; h = 0.29175631001732; k = 11.08360443260358; a = 0; b = 0; e = 0; u = 0; end; shocks; var e; stderr 0.009; var u; stderr 0.009; var e, u = phi*0.009*0.009; end; stoch_simul;' # This writes "example1" of the `Dynare` example with mod extension write_mod(code=dynareCodes,model="example1") # This writes "example1" of the `Dynare` example with mod extension in "DynareR/write_mod" folder write_mod(code=dynareCodes,model="DynareR/write_mod/example1") ## End(Not run)
library(DynareR) ## Not run: dynareCodes='var y, c, k, a, h, b; varexo e, u; parameters beta, rho, alpha, delta, theta, psi, tau; alpha = 0.36; rho = 0.95; tau = 0.025; beta = 0.99; delta = 0.025; psi = 0; theta = 2.95; phi = 0.1; model; c*theta*h^(1+psi)=(1-alpha)*y; k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); k = exp(b)*(y-c)+(1-delta)*k(-1); a = rho*a(-1)+tau*b(-1) + e; b = tau*a(-1)+rho*b(-1) + u; end; initval; y = 1.08068253095672; c = 0.80359242014163; h = 0.29175631001732; k = 11.08360443260358; a = 0; b = 0; e = 0; u = 0; end; shocks; var e; stderr 0.009; var u; stderr 0.009; var e, u = phi*0.009*0.009; end; stoch_simul;' # This writes "example1" of the `Dynare` example with mod extension write_mod(code=dynareCodes,model="example1") # This writes "example1" of the `Dynare` example with mod extension in "DynareR/write_mod" folder write_mod(code=dynareCodes,model="DynareR/write_mod/example1") ## End(Not run)