Question about estimation

Why does your data again have a panel structure? That is not supported.

I apologize, after hp-filtering I joined data again. I will do separate estimations for 3 countries in the sample. The correct file is in the attachment.
Data.xlsx (19.9 KB)

Your plotted data looks strange and its mean does not fit the model variables. I also guess that you are not trying to match levels (which have units) but percentages (logs). You need to specify an appropriate observation equation for that.

Thank you, indeed I wanted to do hp-filtering on logs of consumption, M3 and investment. Please find correct file in the attachment.
Data.xlsx (23.1 KB)

How exactly did you generate those series?

I computed ln(x) for investment (real gross fixed capital formation), consumption (real personal consumption) and M3 data and afterwards I did one way hp-filtering. Before this, I divided the quarterly data with population, to obtain per capita data and inflation, to obtain real data. The data are mostly from Eurostat and run from Q1:1991 to Q1:2020 for Slovenia, Austria and Italy.

The data for real interest rate (three month money market rate) and inflation (consumer price index) obviously weren’t hp-filtered, ln(x) wasn’t computed and weren’t computed in per capita or real terms. Inflation is measured by indeces, rather then in percentage.

Can your provide the full code you used. I am still puzzled by the artifacts at the beginning of the time series. Something with your filtering must have gone wrong.

This is original data file, before computing ln(x) and hp-filtering:

Data 1.xlsx (25.2 KB)

This is file after appling ln(x) (see columns H-J):

Data 2.xlsx (30.8 KB)

At this point I used only Investment column, that is

Data 3.xlsx (14.0 KB)

Now I applied hp-filtering using commands:

addpath C:\dynare\6-unstable-2023-11-21-1249-dd5049cd\matlab;
pkg load io;
y=xlsread(‘Data 3.xlsx’);
[ytrend,ycycle]=one_sided_hp_filter(log(y));

This was the output:
ycycle.txt (2.8 KB)

Or, transformed into Excel:

ycyclex.xlsx (8.2 KB)

Cycle components of consumption and M3 were computed analogously:
Data 4.xlsx (14.0 KB)
Data 5.xlsx (14.0 KB)

using

addpath C:\dynare\6-unstable-2023-11-21-1249-dd5049cd\matlab;
pkg load io;
c=xlsread(‘Data 4.xlsx’);
[ctrend,ccycle]=one_sided_hp_filter(log(c));

and

addpath C:\dynare\6-unstable-2023-11-21-1249-dd5049cd\matlab;
pkg load io;
m=xlsread(‘Data 5.xlsx’);
[mtrend,mcycle]=one_sided_hp_filter(log(m));

I see. So part of the problem is that indeed the first few years of the data are exceptional with pi and r being orders of magnitude bigger than in the other years.

Also note that you are taking the log twice. That is wrong.

So command [ytrend,ycycle]=one_sided_hp_filter(log(y)); both computes ln(x) and hp-filters data? If so, please find hp-filtered data and .mod file in the attachment.

Data.xlsx (20.9 KB)
Model.mod (2.8 KB)

Would you recommend me to drop first two quarters? The economy of my country was undergoing large structural changes at that time due to replacing socialism with capitalism.

This is my output:

How would I run Random Walk Metropolis algorithm (a subtype of Metropolis-Hastings algorithm) at this point?

  1. You can see in the command that you are passing log(y) to the HP filter, not y.
  2. I would drop the first two years or so.
  3. You need to add proper observation equations linking deviations from the the BGP/steady state in the model to the data. They should be of the form
y_obs=log(y)-steady_state(log(y));

Please find attached new .mod file with added observation equations for the three out of five variables (for which I compute logs) at the end. Have done it correctly (the output is the same as before)?

Model.mod (2.8 KB)

Another question. Can I use 2020-2023 data to prolong the time series or was my (Slovenian) economy undergoing too big structural changes at that time too due to the global pandemics?

It seems you uploaded the old file.

I apologize, I am attaching the correct file.

Model.mod (2.9 KB)

It should look like this:
Modelred2.mod (3.0 KB)
Datared.xlsx (20.5 KB)
But you still need a proper observation equation for inflation and interest rates.

Many thanks for the correction. Do the missing two equations look like this?

pi_obs=pi-steady_state(pi)
r_obs=r-steady_state(r)

Modelred2.mod (3.1 KB)

How did you treat the data? It seems these variables are not in deviation from their mean.

They are data for inflation and real interest rates. Indeed, they are not deviations. So, the equations look like this?

pi_obs=pi
r_obs=r

If the frequency and the net/gross concept match, the answer is yes. See also

I am not sure if net/gross concepts match. The inflation was computed like this:

  1. monthly data were multiplied, e.g. 1.5 * 0.6 * 0.2 = 1.032 for months 4-6, to obtain quarterly inflation
  2. Index was computed by (1.032-1)/100=2.313

So, do I have to change something in my equation, perhaps: pi_obs=100*pi+1 ?

Regarding the real interest rates, they were computed as simple averages of monthly data, e.g. for months 1-3 of 2020: (-0,39-0,41-0,42)/3=-0.407
Hence, I assume r_obs=r is correct.