Skip to content
Snippets Groups Projects
Verified Commit 8c99a81c authored by Frédéric Karamé's avatar Frédéric Karamé Committed by Stéphane Adjemian
Browse files

Bug fix and simplification of the Student's pdf.

dynare was crashing without the statistical toolbox from Mathworks.

(cherry picked from commit 18eede9d)
parent 4560123b
No related branches found
No related tags found
No related merge requests found
......@@ -132,7 +132,9 @@ for t=1:sample_size
end
PredictionError = bsxfun(@minus,Y(:,t),tmp(mf1,:));
z = sum(PredictionError.*(H\PredictionError),1) ;
tau_tilde = weights.*(tpdf(z,3*ones(size(z)))+1e-99) ;
% tau_tilde = weights.*(tpdf(z,3*ones(size(z)))+1e-99) ;
ddl = 3 ;
tau_tilde = weights.*(exp(gammaln((ddl + 1) / 2) - gammaln(ddl/2))./(sqrt(ddl*pi).*(1 + (z.^2)./ddl).^((ddl + 1)/2))+1e-99) ;
tau_tilde = tau_tilde/sum(tau_tilde) ;
indx = resample(0,tau_tilde',ParticleOptions);
if pruning
......
......@@ -191,7 +191,9 @@ for t=1:sample_size
PredictionError = bsxfun(@minus,Y(t,:)', tmp(mf1,:));
% Replace Gaussian density with a Student density with 3 degrees of freedom for fat tails.
z = sum(PredictionError.*(ReducedForm.H\PredictionError), 1) ;
tau_tilde(i) = weights(i).*(tpdf(z, 3*ones(size(z)))+1e-99) ;
ddl = 3 ;
%tau_tilde(i) = weights(i).*(tpdf(z,3*ones(size(z)))+1e-99) ;
tau_tilde(i) = weights(i)*(exp(gammaln((ddl + 1) / 2) - gammaln(ddl/2))/(sqrt(ddl*pi)*(1 + (z^2)/ddl)^((ddl + 1)/2))+1e-99) ;
else
tau_tilde(i) = 0 ;
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment