Commit b459f933 authored by Thomas Brand's avatar Thomas Brand

New instructions to automatically run dynare code.

parent d7497786
......@@ -25,9 +25,8 @@ theme <- theme_bw()+ theme(strip.background=element_blank(),
axis.text=element_text(size=10))
blueObsMacro <- "#0D5BA4"
matlab_path <- '/usr/local/bin/matlab'
dynare_path <- '~/Documents/dynare/matlab'
#dynare_path <- '/usr/lib/dynare/matlab'
matlab_path <- '/usr/local/MATLAB/R2015b/bin/matlab'
dynare_path <- '/usr/local/dynare/matlab'
```
This post replicates the estimation of the cash in advance model (termed M1 in the paper) described in @Scho00, with updated data. This implementation was written by Michel Juillard and is given in the `examples` folder of Dynare.
......@@ -131,7 +130,7 @@ cat(readLines("fs2000.mod")[79], sep= '\n')
You can run Dynare directly from this file, but before that you must check the `dynare_path` and `matlab_path` and you must have a version of Dynare >= 4.4 (in order to read csv file for estimation).
```{r eval=F}
```{r eval=T}
system(paste(matlab_path, '-nosplash -nodisplay -r "addpath', dynare_path , '; dynare fs2000; exit" '))
```
......@@ -196,58 +195,5 @@ kable(priorPost)
```
## Bayesian impulse response function
The shape of our impulse response function are similar to the posterior distribution of impulse response functions of @Scho00 (Figure 1, first row, p.664).
```{r}
birf <- subset(oo_,row.names(oo_)=="PosteriorIRF")[[1]][[1]]
names <- as.vector(row.names(subset(birf,row.names(birf)=="Mean")[[1]]))
meanbirf <- data.frame(meas="mean",
var = names,
matrix(unlist(subset(birf,row.names(birf)=="Mean")),
nrow=length(names),
byrow=T))
infbirf <- data.frame(meas="inf",
var = names,
matrix(unlist(subset(birf,row.names(birf)=="HPDinf")),
nrow=length(names),
byrow=T))
supbirf <- data.frame(meas="sup",
var = names,
matrix(unlist(subset(birf,row.names(birf)=="HPDsup")),
nrow=length(names),
byrow=T))
birf <- rbind(meanbirf,infbirf,supbirf) %>%
separate(col=var,into=c("var","shock"))
colnames(birf) <- gsub("X","",colnames(birf))
birf_df <-
birf %>%
gather(time,values,-meas,-shock,-var) %>%
mutate(time=as.numeric(time),
values=100*values) %>%
spread(meas,values)
listVar <- list("1- Output growth" = "gyObs",
"2- Inflation" = "gpObs")
birf_df$var <- factor(birf_df$var)
levels(birf_df$var)<-listVar
```
```{r fig.align="center", fig.height=4}
birf_df %>% filter(shock=="eM") %>%
ggplot(aes(x=time,y=mean,group=shock))+
geom_line(size=0.8,colour="#1F77B4")+
geom_ribbon(aes(ymin=inf,ymax=sup),alpha=0.6,fill="#D6E3F3")+
facet_wrap(~var,scales="free_y")+
xlab(NULL) + ylab("Percent")+theme_bw()+theme+
ggtitle("Monetary shock")
```
# References
\ No newline at end of file
......@@ -76,5 +76,5 @@ end;
varobs gpObs gyObs;
estimation(order=1, datafile=fs2000_data, loglinear, mh_replic=2000, mh_nblocks=2, mh_jscale=0.8, bayesian_irf, irf=40, nograph) gyObs gpObs;
estimation(order=1, datafile=fs2000_data, loglinear, mh_replic=2000, mh_nblocks=2, mh_jscale=0.8);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment