Commit d6db7516 authored by Thomas Brand's avatar Thomas Brand

Add three new observables (neer, imports, exports) and three shocks.

parent 7efa3088
......@@ -9,8 +9,7 @@ output:
```{r, message=FALSE, warning=FALSE, echo=FALSE, results='hide'}
if (!"pacman" %in% installed.packages()[,"Package"]) install.packages("pacman", repos='http://cran.r-project.org')
pacman::p_load(tidyverse,stringr,magrittr,zoo,lubridate,rootSolve,knitr,readxl)
pacman::p_load_gh("dbnomics/rdbnomics")
pacman::p_load(tidyverse,rdbnomics,stringr,magrittr,zoo,lubridate,rootSolve,knitr,readxl)
opts_chunk$set(fig.align="center", message=FALSE, warning=FALSE, cache=FALSE)
......@@ -101,14 +100,31 @@ FR_data <-
debt=100*debt/(defgdp*gdp),
gdp_rpc=1e+6*gdp/pop,
world_demand,
oil_prices=oil_prices$value) %>%
left_join(itrqupdate) %>%
left_join(tauls_df)
neer,
imports_rpc=imports/pop,
exports_rpc=exports/pop,
oil_prices=oil_prices$value/defgdp) %>%
left_join(itrqupdate)
# %>%
# left_join(tauls_df)
```
```{r}
sw03 <- read_csv("http://shiny.nomics.world/data/EA_SW_rawdata.csv") %>%
filter(period >="1980-01-01")
EA_data <-
sw03 %>%
filter(year(period)>=1995) %>%
transmute(period=period,
eadefgdp = defgdp,
eagdp_rpc=1e+6*gdp/(pop*1000))
```
```{r}
FR_data2017 <-
FR_data %>%
inner_join(EA_data, by="period") %>%
filter(year(period)<2018) %>%
mutate(period=gsub(" ", "", as.yearqtr(period)))
......@@ -116,16 +132,16 @@ write_csv(FR_data2017,"dataFR.csv")
```
```{r}
```{r, eval=F}
dataFR <- FR_data
hypo <-
read_excel("hypo_pstab.xls") %>%
read_excel("hypo_plf.xls") %>%
gather(period,value,-variable) %>%
arrange(variable,period)
```
```{r}
```{r, eval=F}
vars <- c(quo(gdp_rpc),quo(conso_rpc),quo(inves_rpc))
finaltib1 <- tibble()
......@@ -173,7 +189,7 @@ for (var in vars){
}
```
```{r}
```{r, eval=F}
vars <- c(quo(pubcons_rpc),quo(tfs_rpc),quo(pubinves_rpc),quo(othgov_rpc),quo(tauls))
finaltib1bis <- tibble()
......@@ -220,7 +236,7 @@ for (var in vars){
}
```
```{r}
```{r, eval=F}
vars <- c(quo(defgdp),quo(world_demand),quo(pinves_defl),quo(wage_rph),quo(oil_prices))
finaltib2 <- tibble()
......@@ -268,7 +284,7 @@ for (var in vars){
}
```
```{r}
```{r, eval=F}
vars <- c(quo(re),quo(tauc),quo(taun),quo(tauwf),quo(tauwh))
finaltib3 <- tibble()
......@@ -317,7 +333,7 @@ for (var in vars){
```
```{r}
```{r, eval=F}
vars <- c(quo(debt))
finaltib4 <- tibble()
......@@ -364,7 +380,7 @@ for (var in vars){
}
```
```{r}
```{r, eval=F}
dataFR_forecast <-
dataFR %>%
gather(var,value,-period) %>%
......@@ -379,16 +395,16 @@ dataFR_forecast2 <-
dataFR_forecast2[is.na(dataFR_forecast2)] <- NaN
write_csv(dataFR_forecast2,"dataFR_forecast.csv")
write_csv(dataFR_forecast2,"dataFR_forecast_PLF_new.csv")
```
```{r}
```{r, eval=F}
dataFR_forecast_plot <-
dataFR_forecast %>%
gather(var,value,-period)
ggplot(dataFR_forecast_plot,aes(period,value))+
geom_line()+
facet_wrap(~var,scales = "free_y")
ggsave("forecast_PLF.pdf")
```
......@@ -23,4 +23,7 @@ var YW_EXO; stderr 1;
var POIL_EXO; stderr 1;
var YDZE_EXO; stderr 1;
var PIZE_EXO; stderr 1;
var XIM_EXO; stderr 1;
var EPSX_EXO; stderr 1;
var PIW_EXO; stderr 1;
end;
......@@ -14,7 +14,7 @@ tauo=0;
bigtheta=0.005;
signalcorr=0;
weONBAR=0.005;
gammab=0.0000001;
%gammab=0.000000001;
beta=0.9971;
delta=0.04;
......
......@@ -64,7 +64,7 @@ TR
CNR
CR
PMOP
PXOPEX
PXOPEX (measure='%', long_name='Termes de l echange')
GM1
GM2
PIMSTAR
......@@ -93,7 +93,7 @@ IM
CD
ID
PIM
PIX
PIX (measure='%', long_name='Prix des exports en devise')
PWOPEX
POILOPEX
PIW
......@@ -120,7 +120,7 @@ XIBW
XIX
OMEGAC
OMEGAI
DELTAEX
DELTAEX (measure='%', long_name='Taux de change')
TB
ZETAI
GOV
......@@ -155,5 +155,7 @@ YWORLD_OBS $YWORLD\_OBS$ (measure='%', long_name='Foreign demand')
POIL_OBS $OIL\_OBS$ (measure='%',long_name='Oil price')
YDZE_OBS $YDZE\_OBS$ (measure='%', long_name='Euro area GDP')
PIZE_OBS $PIZE\_OBS$ (measure='%', long_name='Euro area inflation')
DELTAEX_OBS $PIZE\_OBS$ (measure='%', long_name='Nominal effective exchange rate')
M_OBS $PIZE\_OBS$ (measure='%', long_name='Imports per capita')
X_OBS $PIZE\_OBS$ (measure='%', long_name='Exports per capita')
;
......@@ -23,7 +23,7 @@ gammai, GAMMA_PDF, 2.5, 1;
gammapi, NORMAL_PDF, 1.7, 0.1;
%gammapi, NORMAL_PDF, 5, 1.5;
gammay, BETA_PDF, 0.5, 0.2;
%gammab, BETA_PDF, 0.001, 0.0005;
gammab, BETA_PDF, 0.001, 0.0005;
FBAR, BETA_PDF, 0.0075, 0.00375;
rhopirze, BETA_PDF, 0.5, 0.2;
......@@ -37,26 +37,6 @@ rhogc, BETA_PDF, 0.5, 0.2;
rhogi, BETA_PDF, 0.5, 0.2;
rhot, BETA_PDF, 0.5, 0.2;
rhoothgov, BETA_PDF, 0.5, 0.2;
%rhotaucy, NORMAL_PDF, 0., 2;
%rhotauny, NORMAL_PDF, 0., 2;
%rhotauwhy, NORMAL_PDF, 0., 2;
%rhotauwfy, NORMAL_PDF, 0., 2;
%rhotaulsy, NORMAL_PDF, 0., 2;
%rhogcy, NORMAL_PDF, 0., 2;
%rhogiy, NORMAL_PDF, 0., 2;
%rhoty, NORMAL_PDF, 0., 2;
%rhoothgovy, NORMAL_PDF, 0., 2;
%rhotaucb, NORMAL_PDF, 0., 2;
%rhotaunb, NORMAL_PDF, 0., 2;
%rhotauwhb, NORMAL_PDF, 0., 2;
%rhotauwfb, NORMAL_PDF, 0., 2;
%rhotaulsb, NORMAL_PDF, 0., 2;
%rhogcb, NORMAL_PDF, 0., 2;
%rhogib, NORMAL_PDF, 0., 2;
%rhotb, NORMAL_PDF, 0., 2;
%rhoothgovb, NORMAL_PDF, 0., 2;
rhogb, NORMAL_PDF, -0.002, 0.001;
%rhogb, NORMAL_PDF, -0.006, 0.0025;
rhogy, NORMAL_PDF, 0, 0.01;
......@@ -74,6 +54,9 @@ rhor, BETA_PDF, 0.75, 0.10;
rhod, BETA_PDF, 0.75, 0.10;
rhoxib, BETA_PDF, 0.75, 0.10;
rhosigma, BETA_PDF, 0.75, 0.10;
rhoxim, BETA_PDF, 0.75, 0.10;
rhoepsx, BETA_PDF, 0.75, 0.10;
rhopiw, BETA_PDF, 0.75, 0.10;
sigtauc, UNIFORM_PDF,,, 0, 1;
sigtaun, UNIFORM_PDF,,, 0, 1;
......@@ -99,4 +82,7 @@ sigyw, UNIFORM_PDF,,, 0, 1;
sigpoil, UNIFORM_PDF,,, 0, 1;
sigydze, UNIFORM_PDF,,, 0, 1;
sigpize, UNIFORM_PDF,,, 0, 1;
sigxim, UNIFORM_PDF,,, 0, 1;
sigepsx, UNIFORM_PDF,,, 0, 1;
sigpiw, UNIFORM_PDF,,, 0, 1;
stderr NETWORTH_OBS,UNIFORM_PDF,,, 0, 1;
......@@ -23,4 +23,7 @@ YW_EXO $\sigma_{yw}$ (long_name='Foreign demand', measure='shock')
POIL_EXO $\sigma_{oil}$ (long_name='Oil price', measure='shock')
YDZE_EXO $\sigma_{ydze}$ (long_name='Euro area GDP', measure='shock')
PIZE_EXO $\sigma_{\pi ze}$ (long_name='Euro area inflation', measure='shock')
XIM_EXO $\sigma_{\xi m}$ (long_name='Import demand', measure='shock')
EPSX_EXO $\sigma_{\xi x}$ (long_name='Export price markup', measure='shock')
PIW_EXO $\sigma_{\pi w}$ (long_name='Foreign inflation', measure='shock')
;
......@@ -31,6 +31,9 @@ dataFR = dataFR.rename('world_demand', 'YWORLD_OBS');
dataFR = dataFR.rename('oil_prices', 'POIL_OBS');
dataFR = dataFR.rename('eagdp_rpc', 'YDZE_OBS');
dataFR = dataFR.rename('eadefgdp', 'PIZE_OBS');
dataFR = dataFR.rename('neer', 'DELTAEX_OBS');
dataFR = dataFR.rename('imports_rpc', 'M_OBS');
dataFR = dataFR.rename('exports_rpc', 'X_OBS');
// Set subsample used to demean the dataFR
range = 1995Q2:2016Q4;
......
......@@ -255,7 +255,8 @@ CROYBAR=(1-omega)*PCOP*CR/YD;
CNROYBAR=omega*PCOP*CNR/YD;
IOYBAR=PIOP*I/YD;
MOYBAR=(PMOP*VM*YMZ+POILOPEX*CO)/YD;
XOYBAR=PXOPEX*X/YD;
PXOYBAR=PXOPEX*X/YD;
XOYBAR=X/YD;
EXBWOYBAR=EXBW/YD;
BOYBAR=B*YD/YD;
REVOYBAR=REVGDP;
......@@ -295,4 +296,7 @@ TAUC_OBS=TAUC;
TAUN_OBS=TAUN;
TAUWH_OBS=TAUWH;
TAUWF_OBS=TAUWF;
DELTAEX_OBS=1;
M_OBS=1;
X_OBS=1;
......@@ -147,10 +147,10 @@ GAMMAPRI=gammai*(XIM^(-1/gammai)*(IM/I)/(IM(-1)/I(-1))-1)*(XIM^(-1/gammai)*1/I/(
% PUBLIC AUTHORITIES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PIRZE=PIRZE(-1)^rhopirze*PIBAR^(1-rhopirze);
YDRZE=YDRZE(-1)^rhoydrze*steady_state(YDRZE)^(1-rhoydrze);
PIZE=PI^shfr*PIRZE^(1-shfr)*exp(sigpize*PIZE_EXO);
YDZE=YD^shfr*YDRZE^(1-shfr)*exp(sigydze*YDZE_EXO);
PIRZE=PIRZE(-1)^rhopirze*PIBAR^(1-rhopirze)*exp(sigpize*PIZE_EXO);
YDRZE=YDRZE(-1)^rhoydrze*steady_state(YDRZE)^(1-rhoydrze)*exp(sigydze*YDZE_EXO);
PIZE=PI^shfr*PIRZE^(1-shfr);
YDZE=YD^shfr*YDRZE^(1-shfr);
% Taylor rule
R/steady_state(R)=(R(-1)/steady_state(R))^rhor*((PIZE/PIBAR)^(gammapi)*(YDZE/YDZE(-1))^(gammay))^(1-rhor)*exp(XIR);
......@@ -210,11 +210,11 @@ PIW=PWOPEX/PWOPEX(-1)*PI/DELTAEX;
%markup shocks
%EPSM=EPSM(-1)^rhoepsm*EPSMBAR^(1-rhoepsm)*exp(sigepsm*EPSM_EXO);
EPSM=steady_state(EPSM);
%EPSX=EPSX(-1)^rhoepsx*EPSXBAR^(1-rhoepsx)*exp(sigepsx*EPSX_EXO);
EPSX=steady_state(EPSX);
EPSX=EPSX(-1)^rhoepsx*EPSXBAR^(1-rhoepsx)*exp(sigepsx*EPSX_EXO);
%EPSX=steady_state(EPSX);
%import demand shock
%XIM=XIM(-1)^rhoxim*exp(sigxim*XIM_EXO);
XIM=steady_state(XIM);
XIM=XIM(-1)^rhoxim*exp(sigxim*XIM_EXO);
%XIM=steady_state(XIM);
%export preference
%XIX=XIX(-1)^rhoxix*exp(sigxix*XIX_EXO);
XIX=steady_state(XIX);
......@@ -222,8 +222,8 @@ XIX=steady_state(XIX);
%XIBW=XIBW(-1)^rhoxibw*exp(sigxibw*XIBW_EXO);
XIBW=steady_state(XIBW);
%foreign inflation
%PIW=PIW(-1)^rhopiw*steady_state(PIW)^(1-rhopiw)*exp(sigpiw*PIW_EXO);
PIW=steady_state(PIW);
PIW=PIW(-1)^rhopiw*steady_state(PIW)^(1-rhopiw)*exp(sigpiw*PIW_EXO);
%PIW=steady_state(PIW);
%foreign interest rate
%RW=RW(-1)^rhorw*steady_state(RW)^(1-rhorw)*exp(sigrw*RW_EXO);
RW=steady_state(RW);
......@@ -293,3 +293,6 @@ YWORLD_OBS=YW/YW(-1);
POIL_OBS=POILOPEX/POILOPEX(-1);
PIZE_OBS=PIZE/PIBAR;
YDZE_OBS=YDZE/YDZE(-1);
DELTAEX_OBS=DELTAEX;
M_OBS=M/M(-1)*Z/ZBAR;
X_OBS=X/X(-1)*Z/ZBAR;
......@@ -90,26 +90,6 @@ rhogc $\rho_{gc}$ (long_name='Autocorrelation, government consumption shock', me
rhogi $\rho_{gi}$ (long_name='Autocorrelation, government investment shock', measure='shock')
rhot $\rho_t$ (long_name='Autocorrelation, government transfers shock', measure='shock')
rhoothgov $\rho_{othgov}$ (long_name='Autocorrelation, other government expenditures shock', measure='shock')
%rhotaucy $\rho_{\tau c}$ (long_name='Output feedback, tax rate on consumption', measure='shock')
%rhotauny $\rho_{\tau n}$ (long_name='Output feedback, tax rate on labour income', measure='shock')
%rhotauwhy $\rho_{\tau wh}$ (long_name='Output feedback, contribution rate to social security by employees', measure='shock')
%rhotauwfy $\rho_{\tau wf}$ (long_name='Output feedback, contribution rate to social security, by employers', measure='shock')
%rhotaulsy $\rho_{\tau ls}$ (long_name='Output feedback, lump-sum transfers', measure='shock')
%rhogcy $\rho_{g y}$ (long_name='Output feedback, government consumption', measure='shock')
%rhogiy $\rho_{g y}$ (long_name='Output feedback, government investment', measure='shock')
%rhoty $\rho_{g y}$ (long_name='Output feedback, government transfers', measure='shock')
%rhoothgovy $\rho_{g y}$ (long_name='Output feedback, other government expenditures', measure='shock')
%rhotaucb $\rho_{\tau c}$ (long_name='Debt feedback, tax rate on consumption', measure='shock')
%rhotaunb $\rho_{\tau n}$ (long_name='Debt feedback, tax rate on labour income', measure='shock')
%rhotauwhb $\rho_{\tau wh}$ (long_name='Debt feedback, contribution rate to social security by employees', measure='shock')
%rhotauwfb $\rho_{\tau wf}$ (long_name='Debt feedback, contribution rate to social security, by employers', measure='shock')
%rhotaulsb $\rho_{\tau ls}$ (long_name='Debt feedback, lump-sum transfers', measure='shock')
%rhogcb $\rho_{g b}$ (long_name='Debt feedback, government consumption', measure='shock')
%rhogib $\rho_{g b}$ (long_name='Debt feedback, government investment', measure='shock')
%rhotb $\rho_{g b}$ (long_name='Debt feedback, government transfers', measure='shock')
%rhoothgovb $\rho_{g b}$ (long_name='Debt feedback, other government expenditures', measure='shock')
rhogb $\rho_{g b}$ (long_name='Debt feedback, government expenditures', measure='shock')
rhogy $\rho_{g y}$ (long_name='Output feedback, government expenditures', measure='shock')
rhotauy $\rho_{\tau y}$ (long_name='Output feedback, government receipts', measure='shock')
......@@ -126,6 +106,9 @@ rhoxib $\rho_{\xi b}$ (long_name='Autocorrelation, government bond risk shock',
rhosigma $\rho_{\sigma}$ (long_name='Autocorrelation, financial risk shock', measure='shock')
rhoyw $\rho_{yw}$ (long_name='Autocorrelation, foreign demand shock', measure='shock')
rhopoil $\rho_{oil}$ (long_name='Autocorrelation, oil price shock', measure='shock')
rhoxim $\rho_{\xi m}$ (long_name='Autocorrelation, import demand shock', measure='shock')
rhoepsx $\rho_{\epsilon x}$ (long_name='Autocorrelation, export price markup shock', measure='shock')
rhopiw $\rho_{\pi w}$ (long_name='Autocorrelation, foreign inflation shock', measure='shock')
sigtauc $\sigma_{\tau c}$ (long_name='Standard deviation, tax rate on consumption shock', measure='shock')
sigtaun $\sigma_{\tau n}$ (long_name='Standard deviation, tax rate on labour income shock', measure='shock')
......@@ -151,4 +134,7 @@ sigyw $\sigma_{yw}$ (long_name='Standard deviation, foreign demand shock', measu
sigpoil $\sigma_{oil}$ (long_name='Standard deviation, oil price shock', measure='shock')
sigydze $\sigma_{ydze}$ (long_name='Standard deviation, Euro area GDP shock', measure='shock')
sigpize $\sigma_{\pi ze}$ (long_name='Standard deviation, Euro area inflation shock', measure='shock')
sigxim $\sigma_{\xi m}$ (long_name='Standard deviation, import demand shock', measure='shock')
sigepsx $\sigma_{\epsilon x}$ (long_name='Standard deviation, export price markup shock', measure='shock')
sigpiw $\sigma_{\pi w}$ (long_name='Standard deviation, foreign inflation shock', measure='shock')
;
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