dynare/trunk:: (dsge-var)

+ Added support for xls files.
+ Fixed a bug  appearing when the dafa file and the  mod files are not
in the same directory.


git-svn-id: https://www.dynare.org/svn/dynare/trunk@2827 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
stepan 2009-07-09 15:03:11 +00:00
parent c9d08951bf
commit a4d01dc31d
3 changed files with 7 additions and 15 deletions

View File

@ -131,7 +131,8 @@ if MAX_nirfs_dsgevar
end end
[mYY,mXY,mYX,mXX,Ydata,Xdata] = ... [mYY,mXY,mYX,mXX,Ydata,Xdata] = ...
var_sample_moments(options_.first_obs,options_.first_obs+options_.nobs-1,... var_sample_moments(options_.first_obs,options_.first_obs+options_.nobs-1,...
options_.varlag,-1,options_.datafile,options_.varobs); options_.varlag,-1,options_.datafile,options_.varobs,...
options_.xls_sheet,options_.xls_range);
NumberOfLags = options_.varlag; NumberOfLags = options_.varlag;
NumberOfLagsTimesNvobs = NumberOfLags*nvobs; NumberOfLagsTimesNvobs = NumberOfLags*nvobs;
if options_.noconstant if options_.noconstant

View File

@ -303,12 +303,12 @@ if options_.bvar_dsge
['[mYY,mXY,mYX,mXX,Ydata,Xdata] = ' ... ['[mYY,mXY,mYX,mXX,Ydata,Xdata] = ' ...
'var_sample_moments(options_.first_obs,' ... 'var_sample_moments(options_.first_obs,' ...
'options_.first_obs+options_.nobs-1,options_.varlag,-1,' ... 'options_.first_obs+options_.nobs-1,options_.varlag,-1,' ...
'options_.datafile, options_.varobs);']) 'options_.datafile, options_.varobs,options_.xls_sheet,options_.xls_range);'])
else% The steady state is non zero ==> a constant in the VAR is needed! else% The steady state is non zero ==> a constant in the VAR is needed!
evalin('base',['[mYY,mXY,mYX,mXX,Ydata,Xdata] = ' ... evalin('base',['[mYY,mXY,mYX,mXX,Ydata,Xdata] = ' ...
'var_sample_moments(options_.first_obs,' ... 'var_sample_moments(options_.first_obs,' ...
'options_.first_obs+options_.nobs-1,options_.varlag,0,' ... 'options_.first_obs+options_.nobs-1,options_.varlag,0,' ...
'options_.datafile, options_.varobs);']) 'options_.datafile, options_.varobs,options_.xls_sheet,options_.xls_range);'])
end end
end end

View File

@ -1,5 +1,5 @@
function [YtY,XtY,YtX,XtX,Y,X] = ... function [YtY,XtY,YtX,XtX,Y,X] = ...
var_sample_moments(FirstObservation,LastObservation,qlag,var_trend_order,datafile,varobs) var_sample_moments(FirstObservation,LastObservation,qlag,var_trend_order,datafile,varobs,xls_sheet,xls_range)
% Computes the sample moments of a VAR model. % Computes the sample moments of a VAR model.
% %
% The VAR(p) model is defined by: % The VAR(p) model is defined by:
@ -11,7 +11,7 @@ function [YtY,XtY,YtX,XtX,Y,X] = ...
% exogenous (deterministic) variables, C is a q*m real matrix and % exogenous (deterministic) variables, C is a q*m real matrix and
% e_t is a vector of exogenous stochastic shocks. T is the number % e_t is a vector of exogenous stochastic shocks. T is the number
% of observations. The deterministic exogenous variables are assumed to % of observations. The deterministic exogenous variables are assumed to
% be a polynomial trend of order q = "var_trend_ordre". % be a polynomial trend of order q = "var_trend_order".
% %
% We define: % We define:
% %
@ -75,16 +75,7 @@ YtX = [];
XtY = []; XtY = [];
XtX = []; XtX = [];
if exist(datafile) data = read_variables(datafile,varobs,[],xls_sheet,xls_range);
eval(datafile);
else
eval(['load ' datafile]);
end
data = [ ];
for i=1:size(varobs,1)% m is equal to options_.varobs
data = [data eval(deblank(varobs(i,:)))];
end
if qlag > FirstObservation if qlag > FirstObservation
disp('VarSampleMoments :: not enough data to initialize! Try to increase FirstObservation.') disp('VarSampleMoments :: not enough data to initialize! Try to increase FirstObservation.')