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-bf33cf982152time-shift
parent
c9d08951bf
commit
a4d01dc31d
|
@ -131,7 +131,8 @@ if MAX_nirfs_dsgevar
|
|||
end
|
||||
[mYY,mXY,mYX,mXX,Ydata,Xdata] = ...
|
||||
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;
|
||||
NumberOfLagsTimesNvobs = NumberOfLags*nvobs;
|
||||
if options_.noconstant
|
||||
|
|
|
@ -303,12 +303,12 @@ if options_.bvar_dsge
|
|||
['[mYY,mXY,mYX,mXX,Ydata,Xdata] = ' ...
|
||||
'var_sample_moments(options_.first_obs,' ...
|
||||
'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!
|
||||
evalin('base',['[mYY,mXY,mYX,mXX,Ydata,Xdata] = ' ...
|
||||
'var_sample_moments(options_.first_obs,' ...
|
||||
'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
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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.
|
||||
%
|
||||
% 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
|
||||
% e_t is a vector of exogenous stochastic shocks. T is the number
|
||||
% 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:
|
||||
%
|
||||
|
@ -75,16 +75,7 @@ YtX = [];
|
|||
XtY = [];
|
||||
XtX = [];
|
||||
|
||||
if exist(datafile)
|
||||
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
|
||||
data = read_variables(datafile,varobs,[],xls_sheet,xls_range);
|
||||
|
||||
if qlag > FirstObservation
|
||||
disp('VarSampleMoments :: not enough data to initialize! Try to increase FirstObservation.')
|
||||
|
|
Loading…
Reference in New Issue