Delete the nobs
-option. The reason is that you specified first_obs=71
and there are not 117 observations left after that.
Also, please see
Thank you, my file finally started to show some output. Your paper is very useful too.
Anyway, the study that Iām trying to replicate uses seasonally adjusted data for all 5 variables, and detrending for (logs of) consumption, investment and M3 using H-P filter. Iāve done this H-P filtering in Stata, I hope everything is correct. I simply break down each value into cycle and trend part and use trend part only (substracting cycle part).
Data.xlsx (19.4 KB)
Detrending.xlsx (55.8 KB)
Model.mod (2.8 KB)
I obtain 3 error messages, using HP-filtered data. Any ideas are welcome.
You did not declare endogenous variables after the estimation/calib_smoother command.
warning: gaminv: calculation failed to converge for some values.
warning: called from
gaminv at line 101 column 7
prior_bounds at line 91 column 26
dynare_estimation_init at line 195 column 16
dynare_estimation_1 at line 114 column 93
dynare_estimation at line 118 column 5
driver at line 841 column 14
dynare at line 301 column 5
OPTIMIZATION PROBLEM!
(minus) the hessian matrix at the āmodeā is not positive definite!
=> variance of the estimated parameters are not positive.
You should try to change the initial values of the parameters using
the estimated_params_init block, or use another optimization routine.
warning: The results below are most likely wrong!
warning: called from
check_hessian_at_the_mode at line 68 column 5
dynare_estimation_1 at line 301 column 5
dynare_estimation at line 118 column 5
driver at line 841 column 14
dynare at line 301 column 5
ī©é²warning: gaminv: calculation failed to converge for some values.
warning: called from
gaminv at line 101 column 7
prior_bounds at line 91 column 26
set_mcmc_prior_bounds at line 36 column 8
dynare_estimation_1 at line 389 column 12
dynare_estimation at line 118 column 5
driver at line 841 column 14
dynare at line 301 column 5
error: chol: input matrix must be positive definite
error: called from
posterior_sampler_initialization at line 78 column 3
posterior_sampler at line 59 column 115
dynare_estimation_1 at line 411 column 13
dynare_estimation at line 118 column 5
driver at line 841 column 14
dynare at line 301 column 5
You are supposed to estimate the model on the cyclical component, not the trend. Also, you are not supposed to use a two-sided HP filter.
I will correct the estimation on the cyclical component, however I havenāt got any advice on how to do the one sided filter on Statalist forum. Could you please advise me on that? Using hp1 command, I obtained error message:
filter hp1 invalid; valid values are bk, bw, cf, or hp
This is .do file:
clear
cd C:\Usersā¦
insheet using āInflation.csvā, delimiter(ā;ā) clear
gen date1 = qofd(date(date,āMDYā))
format %tq date1
encode panelid, generate(id)
tsset id date1, quarterly
tsfilter hp1 ct=pi
gen tr=pi-ct
I donāt use Stata, but Dynare ships a Matlab implementation: matlab/one_sided_hp_filter.m Ā· master Ā· Dynare / dynare Ā· GitLab
Dear professor,
how do I import excel file with Data into the file for hp-filtering? Simply using the hp-filtering file from internet, I obtain an error message:
error: āyā undefined near line 61, column 15
Data.xlsx (21.8 KB)
one_sided_hp_filter.m (4.2 KB)
Usually
y=xlsread('Data.xlsx');
[ytrend,ycycle]=one_sided_hp_filter(log(y));
- If I include line y=xlsread(āData.xlsxā); into the hp-filtering file, I obtain error message:
warning: function āone_sided_hp_filterā defined within script file āC:\Users.ā¦Desktop\one_sided_hp_filter.mā
error: āxlsreadā undefined near line 1, column 3
Functions for spreadsheet style I/O (.xls .xlsx .sxc .ods .dbf .wk1
etc.) are provided in the io package. See
https://octave.sourceforge.io/io/.
Please read https://www.octave.org/missing.html to learn how you can
contribute missing functionality.
error: called from
one_sided_hp_filter at line 1 column 2
- And if I simply enter line y=xlsread(āData.xlsxā); into Octave command window, I obtain error message:
error: āxlsreadā undefined near line 1, column 3
Functions for spreadsheet style I/O (.xls .xlsx .sxc .ods .dbf .wk1
etc.) are provided in the io package. See
https://octave.sourceforge.io/io/.
Please read https://www.octave.org/missing.html to learn how you can
contribute missing functionality.
Did you install the io
-package in Octave?
I did now, I used pkg load io and afterwards pkg list io, which returned this
Package Name | Version | Installation directory
--------------Ā±--------Ā±----------------------
io | 2.6.4 | C:\Users\svitv\AppData\Roaming\octave\api-v58\packages\io-2.6.4
Nevertheless, using y=xlsread(āData.xlsxā); returns:
error: āxlsreadā undefined near line 1, column 3
Functions for spreadsheet style I/O (.xls .xlsx .sxc .ods .dbf .wk1
etc.) are provided in the io package. See
https://octave.sourceforge.io/io/.
Please read https://www.octave.org/missing.html to learn how you can
contribute missing functionality.
That is strange. Because it is part of Octaveās io
package: Function Reference: xlsread
I tried entering y=xlsread(āData.xlsxā) again, and this time I obtain error message:
error: āgetinterfacesā undefined near line 308, column 16
error: called from
xlsopen at line 308 column 14
xlsread at line 379 column 11
Could the reason be wrong version of Octave? I use 8.4.0.
Looks like something is wrong with the installation of the io
package for Octave. I have the impression that you installed it manually in your home directory. Under Windows that should normally not be needed, because the Windows installer for Octave comes with the io
package installed. In any case, this is not a Dynare issue.
Thank you for your insight. I apologize for asking Octave-related questions here, but could you advise me just on how would I correctly install IO package? Besides pkg load io, I tried also
pkg install -forge io
however I obtain error message:
warning: io is a global package and cannot be removed locally
For information about changes from previous versions of the io package, run ānews ioā.
Can you try removing (or renaming, if you want to be able to roll back) the following directory: C:\Users\svitv\AppData\Roaming\octave\
Perfect, it seems I āreinstalledā Octave. And what would be the right way of installing IO package now? Many thanks!
If you used the Windows installer provided on the Octave website (octave.org), the io
package should already be installed.
Edit: code works now, thanks!
Dear professor,
do you have any code or insight on how to run Random Walk Metropolis algorithm (a subtype of Metropolis-Hastings algorithm)? I have to run this algorithm using real world data in attachment.
Data hp.xls (74 KB)
Model.mod (2.8 KB)