header updated
git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1615 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
a9cb80a29e
commit
d8135e533a
|
@ -1,11 +1,12 @@
|
||||||
function G = rand_inverse_wishart(m, v, H_inv_upper_chol)
|
function G = rand_inverse_wishart(m, v, H_inv_upper_chol)
|
||||||
|
|
||||||
|
% function G = rand_inverse_wishart(m, v, H_inv_upper_chol)
|
||||||
% rand_inverse_wishart Pseudo random matrices drawn from an
|
% rand_inverse_wishart Pseudo random matrices drawn from an
|
||||||
% inverse Wishart distribution
|
% inverse Wishart distribution
|
||||||
%
|
|
||||||
% G = rand_inverse_wishart(m, v, H_inv_upper_chol)
|
% G = rand_inverse_wishart(m, v, H_inv_upper_chol)
|
||||||
%
|
|
||||||
% Returns an m-by-m matrix drawn from an inverse-Wishart distribution.
|
% Returns an m-by-m matrix drawn from an inverse-Wishart distribution.
|
||||||
%
|
%
|
||||||
|
% INPUTS:
|
||||||
% m: dimension of G and H_inv_upper_chol.
|
% m: dimension of G and H_inv_upper_chol.
|
||||||
% v: degrees of freedom, greater or equal than m.
|
% v: degrees of freedom, greater or equal than m.
|
||||||
% H_inv_chol: upper cholesky decomposition of the inverse of the
|
% H_inv_chol: upper cholesky decomposition of the inverse of the
|
||||||
|
@ -13,12 +14,17 @@ function G = rand_inverse_wishart(m, v, H_inv_upper_chol)
|
||||||
% The upper cholesky of the inverse is requested here
|
% The upper cholesky of the inverse is requested here
|
||||||
% in order to avoid to recompute it at every random draw.
|
% in order to avoid to recompute it at every random draw.
|
||||||
% H_inv_upper_chol = chol(inv(H))
|
% H_inv_upper_chol = chol(inv(H))
|
||||||
%
|
% OUTPUTS:
|
||||||
% In other words:
|
% G: G ~ IW(m, v, H) where H = inv(H_inv_upper_chol'*H_inv_upper_chol)
|
||||||
% G ~ IW(m, v, H) where H = inv(H_inv_upper_chol'*H_inv_upper_chol)
|
|
||||||
% or, equivalently, using the correspondence between Wishart and
|
% or, equivalently, using the correspondence between Wishart and
|
||||||
% inverse-Wishart:
|
% inverse-Wishart: inv(G) ~ W(m, v, S) where
|
||||||
% inv(G) ~ W(m, v, S) where S = H_inv_upper_chol'*H_inv_upper_chol = inv(H)
|
% S = H_inv_upper_chol'*H_inv_upper_chol = inv(H)
|
||||||
|
%
|
||||||
|
% SPECIAL REQUIREMENT
|
||||||
|
% none
|
||||||
|
%
|
||||||
|
% part of DYNARE, copyright Dynare Team (2003-2008)
|
||||||
|
% Gnu Public License.
|
||||||
|
|
||||||
X = randn(v, m) * H_inv_upper_chol;
|
X = randn(v, m) * H_inv_upper_chol;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue