Question about estimation

gamm, uniform_pdf, , ,0, 0.1;

is an option. The smallest feasible value is 0 and 10 percent is a rather large standard deviation.

Perfect, thank you.

As a final step in my mater’s thesis, I want to run the parameter stability testing procedure, “Estimate of Set of Stable parameters” developed by Inoue and Rossi (2011), that makes use of Andrews’ (1993) QLR stability test.

I haven’t found any examples of QLR test neither in Manual, this forum nor your Github. So, can it be done in Dynare?

Can you provide an exact reference?

Sure, please see page 11/27.
Jerger Roehe 2011.pdf (261.6 KB)

Dear professor,

could you please comment on the feasibility of running QLR test in Dynare. Many thanks in advance!

Dynare does not feature this particular stability test. But you should be able to use the Dynare output to conduct this test in any statistics package that supports it.

My advisor dr. Masten told me I need bootstrapping loop (calling Dynare from Octave) in order to run QLR stability test. Supposedly, there is no function that will run the test, but I need to program it. Is this true? Thank you.

It seems so. Let me point out that what you are trying to do is well beyond the scope of a Master thesis.

Point taken. I won’t employ ESS procedure by Inoue and Rossi, but just the simple QLR test.

One question, I realised that you told me already how to run block bootstrap in your post from 15 March:

  1. Doing that type of bootstrap is generally straightforward in Dynare. With your posterior mode, you can use stoch_simul with the simul_replic-option to generate artificial data. You then only have to reestimate the model.

Hence, I don’t need Octave like my advisor told me and I can run block bootstrapp resampling in Dynare?

Dr. Andrew Penn from Octave forum sent me here. I’ve successfully built function that uses my real world data for block resampling, however I must “call Dynare” in it (I need mean and standard errors of my observations). Nobody on Octave forum knows how to call Dynare. Here’s my function:

data=[1,574299213 -0,997531123]
func = @(data) [mean(data(:));std(data(:))];
blocksz = 4
bootclust (data, 1000, func, [.025, .975], blocksz);

Octave forum discussion: How to resample data using block bootstrap? - #16 by nrjank - help - GNU Octave

I don’t get it. How would you get a “standard error” for an observation? An observation is a given data.

It appears that I’ve missuderstood the function. Its output are parameters that fit the observed data and not data variables. Its output is a vector of length 16, because I estimate 16 parameters, and its input is the observed data. These are the characteristics of the function:

  1. accepts a single input argument which would be data matrix (either the original one or a resampled one generated by bootclust)
  2. writes this data matrix to a file
  3. runs the dynare .mod script (which reads the file that your function just created)
  4. reads the parameters from the output file created by Dynare after fitting to the data
  5. uses the column vector of parameters as a return value for the function func

Could you help me to begin constructing the function, please? Many thanks in advance!

Further details from Octave forum:

Dear @stepan-a or anybody else on this forum,

I’m kindly asking for help at constructing an Octave function that calls Dynare. At Octave forum, they directed me here, because nobody there knows how to write Dynare code. Thanks.

Hi,

You can use the dynare command (or call it as a function) in a function but I think you have to declare the global variables in the function (M_, options_, oo_, estim_params_, bayestopt_, dataset_, dataset_info, estimation_info). That said, I really doubt it is the way to go to implement your bootstrap (you do not need to run the preprocessor in a loop since the model does not change from one iteration to another).

Best,
Stéphane

1 Like

Many thanks for the answer. Both my advisor dr. Masten and dr. Penn on Octave forum told me the same, that I need to call Dynare while running a block bootstrap.

However, I’m not sure what data to plug in as global variables, as the Dynare Manual on page 211/223 doesn’t mention it.

I tried to name a function and plug in estimated parameter, but I’m not sure how to continue, and, e.g. what M_ stands for.

My input:

dynare function=Myfunction(M_,options_,oo_,estim_params_=gamm,bayestopt_,dataset_,dataset_info)

Octave output is:

warning: function C:\dynare\7-unstable-2023-12-22-1019-7bf0395a\matlab+identification\displa
y.m shadows a built-in function
warning: X13 binary is not available.

Dynare.pdf (951.0 KB)

As @stepan-a mentions, you need to decide what exactly you want to do within the loop. Then it’s straightforward to call the relevant Dynare Matlab functions. There are countless examples of running loops here in the forum.

1 Like

Thanks a million for the answer, I almost gave up. This is what I want to do within the loop: I want to run a ML estimation by calling Dynare from Octave using this procedure:

Without knowing the specifics, the attached files should provide a template
data_fs2000.mat (3.2 KB)
fs2000.mod (2.1 KB)
reestimate.m (237 Bytes)

Dear professor,

first, I have a question about the .MAT data file. It includes two observed variables. How could I make such a file? I created data files with my 5 observed variables, however they are separate files:
itm_obs.mat (1.8 KB)
itr_obs.mat (1.7 KB)
itc_obs.mat (1.8 KB)
itin_obs.mat (1.8 KB)
itpi_obs.mat (1.7 KB)

Also, I noticed that .MOD file includes Bayesian and not a ML estimation (I’m trying to run a ML estimation), but I guess I can replace estimation type without damage.

  1. You could simply save the data in one file with the correct variable naming
save data_mat itm_obs itr_obs itc_obs itin_obs itip_obs ;
  1. Yes, all options can be adjusted, but you need to make sure you read out the correct output.