Fix a bug in the predictive density calculation.

rm-particles^2
Frédéric Karamé 2016-06-30 12:12:58 +02:00
parent 6d1036b738
commit 285d5c1711
1 changed files with 13 additions and 13 deletions

View File

@ -92,10 +92,10 @@ end
% else
% error('Estimation: This approximation for the proposal is not implemented or unknown!')
% end
%nodes = Q_lower_triangular_cholesky*nodes ;
% nodes = (Q_lower_triangular_cholesky*(nodes'))' ;
nodes = zeros(1,number_of_structural_innovations) ;
nodes_weights = 1 ;
nodes_weights = ones(number_of_structural_innovations,1) ;
for t=1:sample_size
yhat = bsxfun(@minus,StateVectors,state_variables_steady_state);
@ -104,14 +104,14 @@ for t=1:sample_size
tmp = 0 ;
tmp_ = 0 ;
for i=1:size(nodes)
[tmp1, tmp1_] = local_state_space_iteration_2(yhat,nodes(i,:)*ones(1,number_of_particles),ghx,ghu,constant,ghxx,ghuu,ghxu,yhat_,steadystate,ThreadsOptions.local_state_space_iteration_2);
[tmp1, tmp1_] = local_state_space_iteration_2(yhat,nodes(i,:)'*ones(1,number_of_particles),ghx,ghu,constant,ghxx,ghuu,ghxu,yhat_,steadystate,ThreadsOptions.local_state_space_iteration_2);
tmp = tmp + nodes_weights(i)*tmp1 ;
tmp_ = tmp_ + nodes_weights(i)*tmp1_ ;
end
else
tmp = 0 ;
for i=1:size(nodes)
tmp = tmp + nodes_weights(i)*local_state_space_iteration_2(yhat,nodes(i,:)*ones(1,number_of_particles),ghx,ghu,constant,ghxx,ghuu,ghxu,ThreadsOptions.local_state_space_iteration_2);
tmp = tmp + nodes_weights(i)*local_state_space_iteration_2(yhat,nodes(i,:)'*ones(1,number_of_particles),ghx,ghu,constant,ghxx,ghuu,ghxu,ThreadsOptions.local_state_space_iteration_2);
end
end
PredictionError = bsxfun(@minus,Y(:,t),tmp(mf1,:));