-
Notifications
You must be signed in to change notification settings - Fork 82
Description
Dear Junior,
I hope this message finds you well.
I am currently working on estimating my MS-DSGE model in MATLAB using the RISE toolbox. When I attempt to run:
mm = estimate(mm);
I encounter the following error:
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.
From my inspection, the variable mm is of class 'rise':
whos mm
class(mm)
ans =
'rise'
It seems that the estimate function may be expecting a different object type (e.g., 'dsge') or a particular setup that I might be missing.
My current workflow is:
clear classes;
clc;
close all;
% load('mydata.mat');
rng(1);
% Y_Gap = mydata.Y_Gap;
% PI = mydata.PI;
% R = mydata.R;
% B = mydata.B;
mydata=xlsread('data.xlsx');
year=mydata(:,1);Y_gap=mydata(:,2);Pi=mydata(:,3);R=mydata(:,4);b_ss=mydata(:,5);
dataset = [Y_gap, Pi, R, b_ss];
dataset = dataset(3:end,:);
data_start = '2000q1';
dataset = ts(data_start, dataset, {'Y_gap','Pi','R','b_ss'});
enddate=obs2date(data_start,size(dataset,1));
vnames=dataset.varnames;
options = optimset('TolFun', 1e-4, 'TolX', 1e-4, ...
'Display', 'iter', 'UseParallel', true, ...
'MaxIter', 9999999, 'MaxFunEvals', 9999);
mm = rise('rsa_ms_practice1.rs', ...
'rise_flags', struct( ...
'msmodel', 3, ... % regime structure (1,2,3,4)
'taxdistortionary', 1, ... % 1=lump-sum, 2=distortionary
'varmodel', 1), ... % 1=small variances, 2=large
'data', dataset, ...
'estim_start_date', obs2date(data_start,1), ...
'kf_presample', 3, ...
'kf_init_variance', 10, ...
'kf_filtering_level', 0, ...
'steady_state_imposed', true, ...
'steady_state_unique', false, ...
'solve_check_stability', true, ...
'optimset', options);
%mm=solve(mm);
%mm.print_solution;
label_1 = {1, 'low_var'; 2, 'high_var'};
label_2 = {1, 'fixed_regime_M'; 2, 'ms_regimes'; 3, 'ms_endog_regimes'; 4, 'fixed_regime_F'};
label_3 = {1, 'non-distortionary'; 2, 'distortionary'};
mm = rise('rsa_ms_practice1', ...
'rise_flags', struct('varmodel', label_1{1,1}, ...
'msmodel', label_2{3,1}, ...
'taxdistortionary', label_3{1,1}), ...
'irf_anticipate', false);
mm=estimate(mm);
[objective,lb,ub,x0,SIG]=pull_objective(mm);
draws_mcmc = 250000;
ndraws_burnin = floor(0.2*draws_mcmc);
mcmc_options=struct('burnin',ndraws_burnin,'N',draws_mcmc,'thin',1); %/,'thin',1
zResults=mh_sampler(objective,lb,ub,mcmc_options,x0,SIG);
%mm=set(mm,'data',dataset,'estim_end_date',enddate);
save('ms_nk_dsge.mat');
I would greatly appreciate your guidance on:
Why estimate(mm) fails on an object of class 'rise'.
How I should properly initialize and estimate an MS-DSGE model using RISE.
As a possible workaround, I am considering using:
mm = estimate(mm, 'data', dataset, 'estim_end_date', enddate);
or converting the model object into a suitable form for estimation.
on the other hand, mm.estimation.priors returns an empty array []. how can I fix it?
mm.estimation.priors
ans =
[]
Thank you in advance for your time and guidance.
Best
Gabriel