Redefine oo_.posterior_std and add oo_.posterior_std_at_mode

Makes clear that oo_.posterior_std_at_mode comes from mode-finding while oo_.posterior_std comes from MCMC
time-shift
Johannes Pfeifer 2015-08-10 18:43:49 +02:00
parent f5c4ab7d80
commit 8a09c61adb
4 changed files with 39 additions and 7 deletions

View File

@ -5975,13 +5975,22 @@ Variable set by the @code{estimation} command, if it is used with
@end defvr
@defvr {MATLAB/Octave variable} oo_.posterior_mode
Variable set by the @code{estimation} command, if it is used with
@code{mh_replic > 0} or @code{load_mh_file} option. Fields are of the form:
Variable set by the @code{estimation} command during mode-finding. Fields are
of the form:
@example
@code{oo_.posterior_mode.@var{ESTIMATED_OBJECT}.@var{VARIABLE_NAME}}
@end example
@end defvr
@defvr {MATLAB/Octave variable} oo_.posterior_std_at_mode
Variable set by the @code{estimation} command during mode-finding. It is based on the
inverse Hessian at @code{oo_.posterior_mode}. Fields are
of the form:
@example
@code{oo_.posterior_std_at_mode.@var{ESTIMATED_OBJECT}.@var{VARIABLE_NAME}}
@end example
@end defvr
@defvr {MATLAB/Octave variable} oo_.posterior_std
Variable set by the @code{estimation} command, if it is used with
@code{mh_replic > 0} or @code{load_mh_file} option. Fields are of the form:
@ -5990,6 +5999,22 @@ Variable set by the @code{estimation} command, if it is used with
@end example
@end defvr
@defvr {MATLAB/Octave variable} oo_.posterior_var
Variable set by the @code{estimation} command, if it is used with
@code{mh_replic > 0} or @code{load_mh_file} option. Fields are of the form:
@example
@code{oo_.posterior_var.@var{ESTIMATED_OBJECT}.@var{VARIABLE_NAME}}
@end example
@end defvr
@defvr {MATLAB/Octave variable} oo_.posterior_median
Variable set by the @code{estimation} command, if it is used with
@code{mh_replic > 0} or @code{load_mh_file} option. Fields are of the form:
@example
@code{oo_.posterior_median.@var{ESTIMATED_OBJECT}.@var{VARIABLE_NAME}}
@end example
@end defvr
Here are some examples of generated variables:
@example

View File

@ -382,6 +382,7 @@ eval(['oo.posterior_hpdinf.' type '.' name ' = hpdinterval(1);']);
eval(['oo.posterior_hpdsup.' type '.' name ' = hpdinterval(2);']);
eval(['oo.posterior_median.' type '.' name ' = postmedian;']);
eval(['oo.posterior_variance.' type '.' name ' = postvar;']);
eval(['oo.posterior_std.' type '.' name ' = sqrt(postvar);']);
eval(['oo.posterior_deciles.' type '.' name ' = postdecile;']);
eval(['oo.posterior_density.' type '.' name ' = density;']);

View File

@ -87,3 +87,9 @@ if isfield(oo_,'FilteredVariables')
end
end
end
%% set old field posterior_std and remove new field posterior_std_at_mode
if isfield(oo_,'posterior_std_at_mode')
oo_.posterior_std=oo_.posterior_std_at_mode;
oo_=rmfield(oo_,'posterior_std_at_mode');
end

View File

@ -73,7 +73,7 @@ if np
header_width,name,xparam1(ip),stdh(ip),tstath(ip));
end
eval(['oo_.' field_name '_mode.parameters.' name ' = xparam1(ip);']);
eval(['oo_.' field_name '_std.parameters.' name ' = stdh(ip);']);
eval(['oo_.' field_name '_std_at_mode.parameters.' name ' = stdh(ip);']);
ip = ip+1;
end
skipline()
@ -95,7 +95,7 @@ if nvx
end
M_.Sigma_e(k,k) = xparam1(ip)*xparam1(ip);
eval(['oo_.' field_name '_mode.shocks_std.' name ' = xparam1(ip);']);
eval(['oo_.' field_name '_std.shocks_std.' name ' = stdh(ip);']);
eval(['oo_.' field_name '_std_at_mode.shocks_std.' name ' = stdh(ip);']);
ip = ip+1;
end
skipline()
@ -116,7 +116,7 @@ if nvx
fprintf('%-*s %8.4f %7.4f %7.4f \n',header_width,name,xparam1(ip),stdh(ip),tstath(ip))
end
eval(['oo_.' field_name '_mode.measurement_errors_std.' name ' = xparam1(ip);']);
eval(['oo_.' field_name '_std.measurement_errors_std.' name ' = stdh(ip);']);
eval(['oo_.' field_name '_std_at_mode.measurement_errors_std.' name ' = stdh(ip);']);
ip = ip+1;
end
skipline()
@ -141,7 +141,7 @@ if ncx
M_.Sigma_e(k1,k2) = xparam1(ip)*sqrt(M_.Sigma_e(k1,k1)*M_.Sigma_e(k2,k2));
M_.Sigma_e(k2,k1) = M_.Sigma_e(k1,k2);
eval(['oo_.' field_name '_mode.shocks_corr.' NAME ' = xparam1(ip);']);
eval(['oo_.' field_name '_std.shocks_corr.' NAME ' = stdh(ip);']);
eval(['oo_.' field_name '_std_at_mode.shocks_corr.' NAME ' = stdh(ip);']);
ip = ip+1;
end
skipline()
@ -164,7 +164,7 @@ if ncn
fprintf('%-*s %8.4f %7.4f %7.4f \n',header_width,name,xparam1(ip),stdh(ip),tstath(ip));
end
eval(['oo_.' field_name '_mode.measurement_errors_corr.' NAME ' = xparam1(ip);']);
eval(['oo_.' field_name '_std.measurement_errors_corr.' NAME ' = stdh(ip);']);
eval(['oo_.' field_name '_std_at_mode.measurement_errors_corr.' NAME ' = stdh(ip);']);
ip = ip+1;
end
skipline()