Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
dynare
Commits
5c4ef3b5
Verified
Commit
5c4ef3b5
authored
5 months ago
by
Frédéric Karamé
Committed by
Sébastien Villemot
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Bug fixes.
parent
6154804f
No related branches found
No related tags found
1 merge request
!2323
Make compatible the outputs of the online particle filter with the Dynare...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/estimation/GetAllPosteriorDraws.m
+13
-43
13 additions, 43 deletions
matlab/estimation/GetAllPosteriorDraws.m
with
13 additions
and
43 deletions
matlab/estimation/GetAllPosteriorDraws.m
+
13
−
43
View file @
5c4ef3b5
...
...
@@ -33,7 +33,6 @@ function draws = GetAllPosteriorDraws(options_, dname, fname, column, FirstLine
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
<<<<<<<
HEAD
if
isnumeric
(
column
)
&&
column
<
0
error
(
'GetAllPosteriorDraws:: column cannot be negative'
);
end
...
...
@@ -48,48 +47,19 @@ if issmc(options_)
draws
=
transpose
(
posterior
.
particles
);
else
draws
=
transpose
(
posterior
.
particles
(
column
,:));
=======
if
ishssmc
(
options_
)
% Load draws from the posterior distribution
pfiles
=
dir
(
sprintf
(
'%s/hssmc/particles-*.mat'
,
dname
));
posterior
=
load
(
sprintf
(
'%s/hssmc/particles-%u-%u.mat'
,
dname
,
length
(
pfiles
),
length
(
pfiles
)));
if
column
==
0
draws
=
posterior
.
tlogpostkernel
;
else
draws
=
transpose
(
posterior
.
particles
(
column
,:));
end
elseif
isdime
(
options_
)
posterior
=
load
(
sprintf
(
'%s%s%s%schains.mat'
,
dname
,
filesep
(),
'dime'
,
filesep
()));
tune
=
posterior
.
tune
;
chains
=
posterior
.
chains
(
end
-
tune
:
end
,:,:);
if
column
>
0
chains
=
reshape
(
chains
,
[],
size
(
chains
,
3
));
draws
=
chains
(:,
column
);
else
draws
=
posterior
.
lprobs
;
end
draws
=
transpose
(
posterior
.
particles
(
column
,:));
elseif
isonline
(
options_
)
posterior
=
load
(
sprintf
(
'%s/online/parameters_particles_final.mat'
,
dname
));
draws
=
transpose
(
posterior
.
param
(
column
,:));
else
iline
=
FirstLine
;
linee
=
1
;
DirectoryName
=
CheckPath
(
'metropolis'
,
dname
);
if
nblcks
>
1
&&
nargin
<
10
draws
=
zeros
(
NumberOfDraws
*
nblcks
,
1
);
iline0
=
iline
;
if
column
>
0
for
blck
=
1
:
nblcks
iline
=
iline0
;
for
file
=
FirstMhFile
:
TotalNumberOfMhFile
load
([
DirectoryName
'/'
fname
'_mh'
int2str
(
file
)
'_blck'
int2str
(
blck
)],
'x2'
)
NumberOfLines
=
size
(
x2
(
iline
:
end
,:),
1
);
draws
(
linee
:
linee
+
NumberOfLines
-
1
)
=
x2
(
iline
:
end
,
column
);
linee
=
linee
+
NumberOfLines
;
iline
=
1
;
end
>>>>>>>
377185759
(
Make
compatible
the
outputs
of
the
online
particle
filter
with
the
Dynare
routines
for
presenting
results
+
migrate
the
Online
Particle
Filter
from
nonlinear
filters
to
posterior
samplers
.
Now
require
to
create
an
online
option
for
posterior_sampling_method
.
)
end
else
draws
=
posterior
.
tlogpostkernel
;
end
elseif
isonline
(
options_
)
% Load draws from the posterior distribution
pfiles
=
dir
(
sprintf
(
'%s/online/particles-*.mat'
,
dname
));
posterior
=
load
(
sprintf
(
'%s/online/particles-final.mat'
,
dname
,
length
(
pfiles
),
length
(
pfiles
)));
if
column
>
0
||
strcmp
(
column
,
'all'
)
if
strcmp
(
column
,
'all'
)
draws
=
transpose
(
posterior
.
param
);
else
draws
=
transpose
(
posterior
.
param
(
column
,:));
end
else
draws
=
posterior
.
tlogpostkernel
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment