Just some cosmetic changes!
git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1389 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
1224cec429
commit
01f5e9aa1f
|
@ -2,8 +2,6 @@ function bvar_forecast(nlags)
|
|||
|
||||
global options_
|
||||
|
||||
nvar = size(options_.varobs,1);
|
||||
|
||||
options_ = set_default_option(options_, 'bvar_replic', 2000);
|
||||
if options_.forecast == 0
|
||||
error('bvar_forecast: you must specify "forecast" option')
|
||||
|
@ -23,12 +21,11 @@ function bvar_forecast(nlags)
|
|||
k = ny*nlags+nx;
|
||||
|
||||
% Declaration of the companion matrix:
|
||||
Companion_matrix = diag(ones(nvar*(nlags-1),1),-nvar);
|
||||
Companion_matrix = diag(ones(ny*(nlags-1),1),-ny);
|
||||
|
||||
p = 0;
|
||||
d = 0;
|
||||
while d<=options_.bvar_replic
|
||||
d = d+1;
|
||||
|
||||
Sigma = rand_inverse_wishart(ny, posterior.df, S_inv_upper_chol);
|
||||
|
||||
|
@ -39,13 +36,13 @@ function bvar_forecast(nlags)
|
|||
Phi = rand_matrix_normal(k, ny, posterior.PhiHat, XXi_lower_chol, Sigma_lower_chol);
|
||||
|
||||
% All the eigenvalues of the companion matrix have to be on or inside the unit circle
|
||||
Companion_matrix(1:nvar,:) = Phi(1:nvar*nlags,:)';
|
||||
Companion_matrix(1:ny,:) = Phi(1:ny*nlags,:)';
|
||||
test = (abs(eig(Companion_matrix)));
|
||||
if any(test>1.0000000000001)
|
||||
p = p+1;
|
||||
d = d-1;
|
||||
continue
|
||||
end
|
||||
d = d+1;
|
||||
|
||||
% Without shocks
|
||||
lags_data = forecast_data.initval;
|
||||
|
|
Loading…
Reference in New Issue