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
920d2af8
Commit
920d2af8
authored
Jan 28, 2013
by
Frédéric Karamé
Browse files
modification of the resampling procedure: only one call for all
parent
1d1137bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
matlab/particle/resample.m
View file @
920d2af8
function
indx
=
resample
(
weights
,
method1
,
method2
)
function
resampled_particles
=
resample
(
particles
,
weights
,
DynareOptions
)
%
Resamples
particles
.
%
@info
:
...
...
@@ -54,23 +54,25 @@ function indx = resample(weights,method1,method2)
%
AUTHOR
(
S
)
frederic
DOT
karame
AT
univ
DASH
evry
DOT
fr
%
stephane
DOT
adjemian
AT
univ
DASH
lemans
DOT
fr
switch
method1
switch
DynareOptions
.
particle
.
resampling
.
method1
case
'
residual
'
if
strcmpi
(
method2
,
'
kitagawa
'
)
indx
=
residual_resampling
(
weights
,
rand
);
elseif
strcmpi
(
method2
,
'
stratified
'
)
indx
=
residual_resampling
(
weights
,
rand
(
size
(
weights
)));
if
strcmpi
(
DynareOptions
.
particle
.
resampling
.
method2
,
'
kitagawa
'
)
resampled_particles
=
residual_resampling
(
particles
,
weights
,
rand
);
elseif
strcmpi
(
DynareOptions
.
particle
.
resampling
.
method2
,
'
stratified
'
)
resampled_particles
=
residual_resampling
(
particles
,
weights
,
rand
(
size
(
weights
)));
else
error
(
'
particle
:
:
resample
:
Unknown
method
!
'
)
end
case
'
traditional
'
if
strcmpi
(
method2
,
'
kitagawa
'
)
indx
=
traditional_resampling
(
weights
,
rand
);
elseif
strcmpi
(
method2
,
'
stratified
'
)
indx
=
traditional_resampling
(
weights
,
rand
(
size
(
weights
)));
if
strcmpi
(
DynareOptions
.
particle
.
resampling
.
method2
,
'
kitagawa
'
)
resampled_particles
=
traditional_resampling
(
particles
,
weights
,
rand
);
elseif
strcmpi
(
DynareOptions
.
particle
.
resampling
.
method2
,
'
stratified
'
)
resampled_particles
=
traditional_resampling
(
particles
,
weights
,
rand
(
size
(
weights
)));
else
error
(
'
particle
:
:
resample
:
Unknown
method
!
'
)
end
case
'
smooth
'
resampled_particles
=
multivariate_smooth_resampling2
(
particles
,
weights
,
DynareOptions
.
particle
.
resampling
.
number_of_partitions
)
;
otherwise
error
(
'
particle
:
:
resample
:
Unknown
method
!
'
)
end
\ No newline at end of file
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