Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dynare
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MichelJuillard
dynare
Commits
074515bf
Commit
074515bf
authored
Nov 19, 2011
by
MichelJuillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug in drawing of prior densities (It must always return
'steps' values)
parent
b58eaa8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
19 deletions
+13
-19
matlab/draw_prior_density.m
matlab/draw_prior_density.m
+13
-19
No files found.
matlab/draw_prior_density.m
View file @
074515bf
...
...
@@ -45,8 +45,7 @@ switch pshape(indx)
density
=
@
(
x
,
a
,
b
,
aa
,
bb
)
betapdf
((
x
-
aa
)/(
bb
-
aa
),
a
,
b
)/(
bb
-
aa
);
infbound
=
betainv
(
truncprior
,
p6
(
indx
),
p7
(
indx
))
*
(
p4
(
indx
)
-
p3
(
indx
))
+
p3
(
indx
);
supbound
=
betainv
(
1
-
truncprior
,
p6
(
indx
),
p7
(
indx
))
*
(
p4
(
indx
)
-
p3
(
indx
))
+
p3
(
indx
);
stepsize
=
(
supbound
-
infbound
)/
steps
;
abscissa
=
infbound
:
stepsize
:
supbound
;
abscissa
=
linspace
(
infbound
,
supbound
,
steps
);
dens
=
density
(
abscissa
,
p6
(
indx
),
p7
(
indx
),
p3
(
indx
),
p4
(
indx
));
case
2
% Generalized Gamma prior
density
=
@
(
x
,
a
,
b
,
c
)
gampdf
(
x
-
c
,
a
,
b
);
...
...
@@ -61,14 +60,12 @@ switch pshape(indx)
rethrow
(
lasterror
)
end
end
stepsize
=
(
supbound
-
infbound
)/
steps
;
abscissa
=
infbound
:
stepsize
:
supbound
;
abscissa
=
linspace
(
infbound
,
supbound
,
steps
);
dens
=
density
(
abscissa
,
p6
(
indx
),
p7
(
indx
),
p3
(
indx
));
case
3
% Gaussian prior
infbound
=
norminv
(
truncprior
,
p6
(
indx
),
p7
(
indx
));
supbound
=
norminv
(
1
-
truncprior
,
p6
(
indx
),
p7
(
indx
));
stepsize
=
(
supbound
-
infbound
)/
steps
;
abscissa
=
infbound
:
stepsize
:
supbound
;
abscissa
=
linspace
(
infbound
,
supbound
,
steps
);
dens
=
normpdf
(
abscissa
,
p6
(
indx
),
p7
(
indx
));
case
4
% Inverse-gamma of type 1 prior
try
...
...
@@ -82,14 +79,12 @@ switch pshape(indx)
rethrow
(
lasterror
)
end
end
stepsize
=
(
supbound
-
infbound
)/
steps
;
abscissa
=
infbound
:
stepsize
:
supbound
;
abscissa
=
linspace
(
infbound
,
supbound
,
steps
);
dens
=
exp
(
lpdfig1
(
abscissa
-
p3
(
indx
),
p6
(
indx
),
p7
(
indx
)));
case
5
% Uniform prior
infbound
=
p6
(
indx
);
supbound
=
p7
(
indx
);
stepsize
=
(
supbound
-
infbound
)/
steps
;
abscissa
=
infbound
:
stepsize
:
supbound
;
abscissa
=
linspace
(
infbound
,
supbound
,
steps
);
dens
=
ones
(
1
,
steps
)
/
(
supbound
-
infbound
);
case
6
% Inverse-gamma of type 2 prior
try
...
...
@@ -103,23 +98,22 @@ switch pshape(indx)
rethrow
(
lasterror
)
end
end
stepsize
=
(
supbound
-
infbound
)/
steps
;
abscissa
=
infbound
:
stepsize
:
supbound
;
abscissa
=
linspace
(
infbound
,
supbound
,
steps
);
dens
=
exp
(
lpdfig2
(
abscissa
-
p3
(
indx
),
p6
(
indx
),
p7
(
indx
)));
otherwise
error
(
sprintf
(
'draw_prior_density: unknown distribution shape (index %d, type %d)'
,
indx
,
pshape
(
indx
)));
end
k
=
[
1
:
length
(
dens
)];
if
pshape
(
indx
)
~=
5
[
junk
,
k1
]
=
max
(
dens
);
if
k1
==
1
||
k1
==
length
(
dens
)
k
=
find
(
dens
<
10
);
k
=
find
(
dens
>
10
);
dens
(
k
)
=
NaN
;
end
end
binf
=
abscissa
(
k
(
1
)
);
bsup
=
abscissa
(
k
(
length
(
k
))
);
x
=
abscissa
(
k
)
;
f
=
dens
(
k
)
;
binf
=
abscissa
(
1
);
bsup
=
abscissa
(
end
);
x
=
abscissa
;
f
=
dens
;
f
(
find
(
x
<
bayestopt_
.
lb
(
indx
)))
=
0
;
f
(
find
(
x
>
bayestopt_
.
ub
(
indx
)))
=
0
;
\ No newline at end of file
f
(
find
(
x
>
bayestopt_
.
ub
(
indx
)))
=
0
;
Write
Preview
Markdown
is supported
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