jmaih / RISE_toolbox

Solution and estimation of Markov Switching Rational Expectations / DSGE Models
BSD 3-Clause "New" or "Revised" License
105 stars 77 forks source link

Problem with estimation #176

Closed Kalinowe closed 1 year ago

Kalinowe commented 1 year ago

Dear Dr Maih, I have a problem estimating a simple markov switching new keynesian dsge model. I'm new to RISE so I expect that I made some error, but what I did was mostly copying from provided examples and the documentation for the estimate function did not help. The errors I am getting are as follows

Dot indexing is not supported for variables of this type.

Error in generic/estimate

Error in dsge/estimate (line 217)
%      observations, such that the deflated data is given by y(t) - z(t)*b.

Error in execute (line 10)
estim = estimate(model);

This is the execution .m file

tmp = importdata('df_markov.csv');
dataList={'y_gap','r','pi'};
mydata=struct();
startdate='2002Q2';
for id=1:size(dataList,2)
    mydata.(dataList{id})=ts(startdate,tmp.data(:,id),dataList{id});
end

model = rise('model.rs', 'data', mydata);
estim = estimate(model);

And this is the model

endogenous pi, "Inflation", y_gap, "Output gap", r, "Interest rate"
exogenous eps_pi "inflation shock", eps_y "real shock"

parameters sigma, kappa, beta, gamma_y, target,  s_tp_1_2, s_tp_2_1

parameters(s,2) gamma_rho

model
y_gap = y_gap(+1) - (1/sigma)*(r - pi(+1)) +eps_y;
pi = beta * pi(+1)+ kappa* y_gap + eps_pi;
r = target + gamma_rho*(pi(+1) - target) + gamma_y * y_gap(+1);

df_markov.csv

I attach the data I would greatly appreciate if you could help me out

jmaih commented 1 year ago

Hi,

There is no information about the estimated parameters.

Cheers,

J.

On Sat, Dec 31, 2022 at 7:10 PM Kalinowe @.***> wrote:

Dear Dr Maih, I have a problem estimating a simple markov switching new keynesian dsge model. I'm new to RISE so I expect that I made some error, but what I did was mostly copying from provided examples and the documentation for the estimate function did not help. The errors I am getting are as follows

Dot indexing is not supported for variables of this type.

Error in generic/estimate

Error in dsge/estimate (line 217) % observations, such that the deflated data is given by y(t) - z(t)*b.

Error in execute (line 10) estim = estimate(model);

This is the execution .m file

tmp = importdata('df_markov.csv'); dataList={'y_gap','r','pi'}; mydata=struct(); startdate='2002Q2'; for id=1:size(dataList,2) mydata.(dataList{id})=ts(startdate,tmp.data(:,id),dataList{id}); end

model = rise('model.rs', 'data', mydata); estim = estimate(model);

And this is the model

endogenous pi, "Inflation", y_gap, "Output gap", r, "Interest rate" exogenous eps_pi "inflation shock", eps_y "real shock"

parameters sigma, kappa, beta, gamma_y, target, s_tp_1_2, s_tp_2_1

parameters(s,2) gamma_rho

model y_gap = y_gap(+1) - (1/sigma)(r - pi(+1)) +eps_y; pi = beta pi(+1)+ kappa y_gap + eps_pi; r = target + gamma_rho(pi(+1) - target) + gamma_y * y_gap(+1);

df_markov.csv https://github.com/jmaih/RISE_toolbox/files/10327800/df_markov.csv

I attach the data I would greatly appreciate if you could help me out

— Reply to this email directly, view it on GitHub https://github.com/jmaih/RISE_toolbox/issues/176, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATKBTY22ISODRKJQPQIPSTWQBZKVANCNFSM6AAAAAATNVBABY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Kalinowe commented 1 year ago

Thank you for replying so quickly I tried it this way

tmp = importdata('df_markov.csv');
dataList={'y_gap','r','pi'};
mydata=struct();
startdate='2002Q2';
for id=1:size(dataList,2)
    mydata.(dataList{id})=ts(startdate,tmp.data(:,id),dataList{id});
end

model = rise('model.rs');

p=struct();
p.beta=0.95;
p.sigma=0.5;
p.kappa= 0.3;
p.gamma_y= 0.5;
p.target= 2.5;

estim = estimate(model, mydata, p);

But unfortunately it still does not work. I'm getting an error that says

y_gap' is not a settable option or property of class rise

I think I may be entering p or mydata in a wrong data format but I tried a few approaches and none of them worked Thank you for your help

jmaih commented 1 year ago

Are you able to successfully run some examples in the example folder? I would suggest 1- you take an example that is closely related to what you want to do 2- you study the example, trying to understand what it does at every step. 3- adapt the example to your own needs

The p you wrote is not data and so cannot be entered as data.

You should provide

Cheers J.

On Sun, Jan 1, 2023, 23:59 Kalinowe @.***> wrote:

Thank you for replying so quickly I tried it this way

tmp = importdata('df_markov.csv'); dataList={'y_gap','r','pi'}; mydata=struct(); startdate='2002Q2'; for id=1:size(dataList,2) mydata.(dataList{id})=ts(startdate,tmp.data(:,id),dataList{id}); end

model = rise('model.rs');

p=struct(); p.beta=0.95; p.sigma=0.5; p.kappa= 0.3; p.gamma_y= 0.5; p.target= 2.5;

estim = estimate(model, mydata, p);

But unfortunately it still does not work. I'm getting an error that says

y_gap' is not a settable option or property of class rise

I think I may be entering p or mydata in a wrong data format but I tried a few approaches and none of them worked Thank you for your help

— Reply to this email directly, view it on GitHub https://github.com/jmaih/RISE_toolbox/issues/176#issuecomment-1368556617, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATKBT2TZSLQK4UAJZ4MXIDWQID6DANCNFSM6AAAAAATNVBABY . You are receiving this because you commented.Message ID: @.***>