Commit c89801b2 authored by Frédéric Karamé's avatar Frédéric Karamé
Browse files

simplification of gaussian mixtures

parent ef042694
...@@ -114,39 +114,142 @@ for g=1:G ...@@ -114,39 +114,142 @@ for g=1:G
StateSqrtP(:,:,g) = temp/sqrt(G) ; StateSqrtP(:,:,g) = temp/sqrt(G) ;
end end
if ParticleOptions.proposal_approximation.cubature % if ParticleOptions.mixture_structural_shocks==1
[StructuralShocksMu,StructuralShocksWeights] = spherical_radial_sigma_points(number_of_structural_innovations); % StructuralShocksMu = zeros(1,number_of_structural_innovations) ;
StructuralShocksWeights = ones(size(StructuralShocksMu,1),1)*StructuralShocksWeights ; % StructuralShocksWeights = 1 ;
elseif ParticleOptions.proposal_approximation.unscented % else
[StructuralShocksMu,StructuralShocksWeights,raf] = unscented_sigma_points(number_of_structural_innovations,ParticleOptions); % if ParticleOptions.proposal_approximation.cubature
else % [StructuralShocksMu,StructuralShocksWeights] = spherical_radial_sigma_points(number_of_structural_innovations);
if ~ParticleOptions.distribution_approximation.montecarlo % StructuralShocksWeights = ones(size(StructuralShocksMu,1),1)*StructuralShocksWeights ;
error('Estimation: This approximation for the proposal is not implemented or unknown!') % elseif ParticleOptions.proposal_approximation.unscented
end % [StructuralShocksMu,StructuralShocksWeights,raf] = unscented_sigma_points(number_of_structural_innovations,ParticleOptions);
end % else
I = size(StructuralShocksWeights,1) ; % if ~ParticleOptions.distribution_approximation.montecarlo
StructuralShocksMu = Q_lower_triangular_cholesky*(StructuralShocksMu') ; % error('Estimation: This approximation for the proposal is not implemented or unknown!')
StructuralShocksSqrtP = zeros(number_of_structural_innovations,number_of_structural_innovations,I) ; % end
for i=1:I % end
StructuralShocksSqrtP(:,:,i) = Q_lower_triangular_cholesky/sqrt(StructuralShocksWeights(i)) ; % end
end % I = size(StructuralShocksWeights,1) ;
% StructuralShocksMu = Q_lower_triangular_cholesky*(StructuralShocksMu') ;
% StructuralShocksSqrtP = zeros(number_of_structural_innovations,number_of_structural_innovations,I) ;
% for i=1:I
% StructuralShocksSqrtP(:,:,i) = Q_lower_triangular_cholesky/sqrt(StructuralShocksWeights(i)) ;
% end
%
% if ParticleOptions.mixture_measurement_shocks==1
% ObservationShocksMu = zeros(1,number_of_observed_variables) ;
% ObservationShocksWeights = 1 ;
% else
% if ParticleOptions.proposal_approximation.cubature
% [ObservationShocksMu,ObservationShocksWeights] = spherical_radial_sigma_points(number_of_observed_variables);
% ObservationShocksWeights = ones(size(ObservationShocksMu,1),1)*ObservationShocksWeights;
% elseif ParticleOptions.proposal_approximation.unscented
% [ObservationShocksMu,ObservationShocksWeights,raf] = unscented_sigma_points(number_of_observed_variables,ParticleOptions);
% else
% if ~ParticleOptions.distribution_approximation.montecarlo
% error('Estimation: This approximation for the proposal is not implemented or unknown!')
% end
% end
% end
% J = size(ObservationShocksWeights,1) ;
% ObservationShocksMu = H_lower_triangular_cholesky*(ObservationShocksMu') ;
% ObservationShocksSqrtP = zeros(number_of_observed_variables,number_of_observed_variables,J) ;
% for j=1:J
% ObservationShocksSqrtP(:,:,j) = H_lower_triangular_cholesky/sqrt(ObservationShocksWeights(j)) ;
% end
if ParticleOptions.proposal_approximation.cubature if ParticleOptions.mixture_structural_shocks==0
[ObservationShocksMu,ObservationShocksWeights] = spherical_radial_sigma_points(number_of_observed_variables); StructuralShocksMu = zeros(1,number_of_structural_innovations) ;
ObservationShocksWeights = ones(size(ObservationShocksMu,1),1)*ObservationShocksWeights; StructuralShocksWeights = 1 ;
elseif ParticleOptions.proposal_approximation.unscented I = 1 ;
[ObservationShocksMu,ObservationShocksWeights,raf] = unscented_sigma_points(number_of_observed_variables,ParticleOptions); StructuralShocksMu = Q_lower_triangular_cholesky*(StructuralShocksMu') ;
StructuralShocksSqrtP = zeros(number_of_structural_innovations,number_of_structural_innovations,I) ;
StructuralShocksSqrtP(:,:,1) = Q_lower_triangular_cholesky ;
elseif ParticleOptions.mixture_structural_shocks==1
if ParticleOptions.proposal_approximation.cubature
[StructuralShocksMu,StructuralShocksWeights] = spherical_radial_sigma_points(number_of_structural_innovations);
StructuralShocksWeights = ones(size(StructuralShocksMu,1),1)*StructuralShocksWeights ;
elseif ParticleOptions.proposal_approximation.unscented
[StructuralShocksMu,StructuralShocksWeights,raf] = unscented_sigma_points(number_of_structural_innovations,ParticleOptions);
else
if ~ParticleOptions.distribution_approximation.montecarlo
error('Estimation: This approximation for the proposal is not implemented or unknown!')
end
end
I = size(StructuralShocksWeights,1) ;
StructuralShocksMu = Q_lower_triangular_cholesky*(StructuralShocksMu') ;
StructuralShocksSqrtP = zeros(number_of_structural_innovations,number_of_structural_innovations,I) ;
for i=1:I
StructuralShocksSqrtP(:,:,i) = Q_lower_triangular_cholesky ;
end
else else
if ~ParticleOptions.distribution_approximation.montecarlo if ParticleOptions.proposal_approximation.cubature
error('Estimation: This approximation for the proposal is not implemented or unknown!') [StructuralShocksMu,StructuralShocksWeights] = spherical_radial_sigma_points(number_of_structural_innovations);
StructuralShocksWeights = ones(size(StructuralShocksMu,1),1)*StructuralShocksWeights ;
elseif ParticleOptions.proposal_approximation.unscented
[StructuralShocksMu,StructuralShocksWeights,raf] = unscented_sigma_points(number_of_structural_innovations,ParticleOptions);
else
if ~ParticleOptions.distribution_approximation.montecarlo
error('Estimation: This approximation for the proposal is not implemented or unknown!')
end
end
I = size(StructuralShocksWeights,1) ;
StructuralShocksMu = Q_lower_triangular_cholesky*(StructuralShocksMu') ;
StructuralShocksSqrtP = zeros(number_of_structural_innovations,number_of_structural_innovations,I) ;
for i=1:I
StructuralShocksSqrtP(:,:,i) = Q_lower_triangular_cholesky/sqrt(StructuralShocksWeights(i)) ;
end end
end end
J = size(ObservationShocksWeights,1) ;
ObservationShocksMu = zeros(1,number_of_observed_variables) ;
ObservationShocksWeights = 1 ;
J = 1 ;
ObservationShocksMu = H_lower_triangular_cholesky*(ObservationShocksMu') ; ObservationShocksMu = H_lower_triangular_cholesky*(ObservationShocksMu') ;
ObservationShocksSqrtP = zeros(number_of_observed_variables,number_of_observed_variables,J) ; ObservationShocksSqrtP = zeros(number_of_observed_variables,number_of_observed_variables,J) ;
for j=1:J ObservationShocksSqrtP(:,:,1) = H_lower_triangular_cholesky ;
ObservationShocksSqrtP(:,:,j) = H_lower_triangular_cholesky/sqrt(ObservationShocksWeights(j)) ;
end % if ParticleOptions.mixture_measurement_shocks==0
% ObservationShocksMu = zeros(1,number_of_observed_variables) ;
% ObservationShocksWeights = 1 ;
% J = 1 ;
% ObservationShocksMu = H_lower_triangular_cholesky*(ObservationShocksMu') ;
% ObservationShocksSqrtP = zeros(number_of_observed_variables,number_of_observed_variables,J) ;
% ObservationShocksSqrtP(:,:,1) = H_lower_triangular_cholesky ;
% elseif ParticleOptions.mixture_measurement_shocks==1
% if ParticleOptions.proposal_approximation.cubature
% [ObservationShocksMu,ObservationShocksWeights] = spherical_radial_sigma_points(number_of_observed_variables);
% ObservationShocksWeights = ones(size(ObservationShocksMu,1),1)*ObservationShocksWeights;
% elseif ParticleOptions.proposal_approximation.unscented
% [ObservationShocksMu,ObservationShocksWeights,raf] = unscented_sigma_points(number_of_observed_variables,ParticleOptions);
% else
% if ~ParticleOptions.distribution_approximation.montecarlo
% error('Estimation: This approximation for the proposal is not implemented or unknown!')
% end
% end
% J = size(ObservationShocksWeights,1) ;
% ObservationShocksMu = H_lower_triangular_cholesky*(ObservationShocksMu') ;
% ObservationShocksSqrtP = zeros(number_of_observed_variables,number_of_observed_variables,J) ;
% for j=1:J
% ObservationShocksSqrtP(:,:,j) = H_lower_triangular_cholesky ;
% end
% else
% if ParticleOptions.proposal_approximation.cubature
% [ObservationShocksMu,ObservationShocksWeights] = spherical_radial_sigma_points(number_of_observed_variables);
% ObservationShocksWeights = ones(size(ObservationShocksMu,1),1)*ObservationShocksWeights;
% elseif ParticleOptions.proposal_approximation.unscented
% [ObservationShocksMu,ObservationShocksWeights,raf] = unscented_sigma_points(number_of_observed_variables,ParticleOptions);
% else
% if ~ParticleOptions.distribution_approximation.montecarlo
% error('Estimation: This approximation for the proposal is not implemented or unknown!')
% end
% end
% J = size(ObservationShocksWeights,1) ;
% ObservationShocksMu = H_lower_triangular_cholesky*(ObservationShocksMu') ;
% ObservationShocksSqrtP = zeros(number_of_observed_variables,number_of_observed_variables,J) ;
% for j=1:J
% ObservationShocksSqrtP(:,:,j) = H_lower_triangular_cholesky/sqrt(ObservationShocksWeights(j)) ;
% end
% end
Gprime = G*I ; Gprime = G*I ;
Gsecond = G*I*J ; Gsecond = G*I*J ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment