Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
22a29ab0
Commit
22a29ab0
authored
Jan 28, 2013
by
Frédéric Karamé
Browse files
modification of the resampling procedure: only one call for all methods
parent
155f6f3b
Changes
1
Hide whitespace changes
Inline
Side-by-side
matlab/particle/gaussian_mixture_filter.m
View file @
22a29ab0
...
...
@@ -180,7 +180,7 @@ for t=1:sample_size
SampleWeights
=
SampleWeights
.
/
SumSampleWeights
;
[
ras
,
SortedRandomIndx
]
=
sort
(
rand
(
1
,
Gsecond
));
SortedRandomIndx
=
SortedRandomIndx
(
1
:
G
);
indx
=
resample
(
SampleWeights
,
DynareOptions
.
particle
.
resampling
.
method1
,
DynareOptions
.
particle
.
resampling
.
method2
)
;
indx
=
index_
resample
(
0
,
SampleWeights
,
DynareOptions
)
;
indx
=
indx
(
SortedRandomIndx
)
;
StateMu
=
StateMuPost
(:,
indx
);
StateSqrtP
=
StateSqrtPPost
(:,:,
indx
);
...
...
@@ -204,7 +204,7 @@ for t=1:sample_size
Neff
=
1
/
sum
(
bsxfun
(
@
power
,
SampleWeights
,
2
))
;
if
(
Neff
<.
5
*
sample_size
&&
strcmpi
(
DynareOptions
.
particle
.
resampling
.
status
,
'generic'
))
||
strcmpi
(
DynareOptions
.
particle
.
resampling
.
status
,
'systematic'
)
ks
=
ks
+
1
;
StateParticles
=
StateParticles
(:,
resample
(
SampleWeights
'
,
DynareOptions
.
particle
.
resampling
.
method1
,
DynareOptions
.
particle
.
resampling
.
method2
))
;
StateParticles
=
resample
(
StateParticles
',SampleWeights,DynareOptions)'
;
StateVectorMean
=
mean
(
StateParticles
,
2
)
;
StateVectorVarianceSquareRoot
=
reduced_rank_cholesky
(
(
StateParticles
*
StateParticles
')/number_of_particles - StateVectorMean*(StateVectorMean'
)
)
'
;
SampleWeights
=
1
/
number_of_particles
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment