Check prior truncation
There are two issues:
a) There are three cases where priors are/should be truncated in Dynare
- If the user explicitly specifies this
- If the prior for a correlation has mass outside [-1,1]
- If prior for standard deviations has mass below 0. #522 (closed) suggests to issue a warning in cases 2 and 3. However, the point where truncation is problematic is computing marginal data densities. I suggest to set a flag for all three cases and issue a warning in marginal_density if the prior was truncated.
b) I am not sure I understand the prior truncation in case 1 above. The manual says that the prior does not integrate to 1 anymore. This is fine. But in set_prior.m
we have code like
k = find(bayestopt_.pshape == 4);
k1 = find(isnan(bayestopt_.p3(k)));
k2 = find(isnan(bayestopt_.p4(k)));
bayestopt_.p3(k(k1)) = zeros(length(k1),1);
bayestopt_.p4(k(k2)) = Inf(length(k2),1);
for i=1:length(k)
[bayestopt_.p6(k(i)),bayestopt_.p7(k(i))] = ...
inverse_gamma_specification(bayestopt_.p1(k(i))-bayestopt_.p3(k(i)),bayestopt_.p2(k(i)),1,0) ;
bayestopt_.p5(k(i)) = compute_prior_mode([ bayestopt_.p6(k(i)) , bayestopt_.p7(k(i)) , bayestopt_.p3(k(i)) ], 4) ;
end
The way I read this, the mean of the prior seems to take the truncation in p3 into account. Thus, instead of fixing the prior distribution according to mean and variance and then truncating it, it seems we are partially setting the mean of the truncated distribution. I am not sure this behavior is desired/expected by the user. We at least need to document what Dynare is doing here.