Differences between revisions 2 and 3
Revision 2 as of 2008-09-01 21:23:01
Size: 1511
Comment:
Revision 3 as of 2008-09-01 21:43:40
Size: 1619
Comment:
Deletions are marked like this. Additions are marked like this.
Line 31: Line 31:

where the black curve is a movering average of the sampled values. That is, if the sampled values are...

How to obtain trace plots after a Metropolis-Hastings

It can be useful to plot iterations vs. sampled values for each variable (parameter) in a chain. If the Metropolis-Hastings converges to a stable distribution, the trace plot has to be stable (e.g. no trend in the sampled values).

After a metropolis (that is after the estimation command in the mod file) you just have to write:

trace_plot(options_,M_,estim_params_,type,blck,name1,name2)

where:

  • options_, M_ and estim_params_ are Dynare's global structures describing the model,
  • type is a string equal to 'DeepParameter' (for a parameter of the structural model), 'MeasurementError' (std. or correlation in the measurement equation error) or 'StructuralShock' (for the standard deviation of a structural shock or the correlation between two shocks),

  • blck<mh_nblck is an integer designing one of the mh chains.

  • name1 is a string designing for instance the name of a deep parameter
  • name2 is an optional second string needed if you are interested in the correlation between two structural shocks or two measurement errors.

After the estimation of the model in fs2000.mod if we want to build a trace plot for parameter alp, we just have to write:

trace_plot(options_,M_,estim_params_,'DeepParameter',2,'alp')

and the following plot will pop up:

attachment:trace_plot.jpg

where the black curve is a movering average of the sampled values. That is, if the sampled values are...

DynareWiki: TracePlots (last edited 2009-03-25 17:12:09 by localhost)