Merge remote-tracking branch 'upstream/master'
commit
e18dc65871
|
@ -47,8 +47,6 @@ function sp = colon(a,b)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if nargin~=2
|
||||
error('dynDate::colon: I need exactly two input arguments!')
|
||||
end
|
||||
|
@ -71,22 +69,6 @@ for t=1:n
|
|||
a = +a;
|
||||
sp = sp.append(a);
|
||||
end
|
||||
% $$$ if a==b% Time range with only one date.
|
||||
% $$$ sp = dynDates(a);
|
||||
% $$$ sp = sp.setFreq(a.freq);
|
||||
% $$$ sp = sp.setSize(1);
|
||||
% $$$ sp = sp.setTime(1,a.time);
|
||||
% $$$ else
|
||||
% $$$ n = b-a;
|
||||
% $$$ sp = dynDates();
|
||||
% $$$ sp = sp.setFreq(a.freq);
|
||||
% $$$ sp = sp.setSize(n+1);
|
||||
% $$$ sp = sp.setTime(1,a.time);
|
||||
% $$$ for t=2:n+1
|
||||
% $$$ a = +a;
|
||||
% $$$ sp = sp.setTime(t,a.time);
|
||||
% $$$ end
|
||||
% $$$ end
|
||||
|
||||
%@test:1
|
||||
%$ % Define two dates
|
||||
|
|
|
@ -17,5 +17,4 @@ function display(d)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
fprintf('%s = <dynDate: %s>\n', inputname(1), format(d));
|
||||
end
|
||||
fprintf('%s = <dynDate: %s>\n', inputname(1), format(d));
|
|
@ -1,4 +1,4 @@
|
|||
function date = dynDate(a)
|
||||
function date = dynDate(a,b)
|
||||
|
||||
%@info:
|
||||
%! @deftypefn {Function File} {@var{date} =} dynDate (@var{a})
|
||||
|
@ -60,8 +60,6 @@ function date = dynDate(a)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
date = struct;
|
||||
|
||||
date.freq = NaN;
|
||||
|
@ -75,6 +73,7 @@ switch nargin
|
|||
return
|
||||
case 1
|
||||
if ischar(a)% Weekly, Monthly or Quaterly data.
|
||||
a = upper(a);
|
||||
if length(a)>1
|
||||
quaterly = findstr('Q',a);
|
||||
monthly = findstr('M',a);
|
||||
|
@ -129,6 +128,23 @@ switch nargin
|
|||
error('dynDate:: Can''t instantiate the class, wrong calling sequence!')
|
||||
end
|
||||
end
|
||||
case 2 % provide time and freq to instantiate a dynDate object
|
||||
date = dynDate();
|
||||
if isnumeric(b) && isscalar(b) && (b==1 || b==4 || b==12 || b==52)
|
||||
date.freq = b;
|
||||
if ~isnumeric(a) && size(a)~=2 && size(a,2)~=2
|
||||
error(['dynDate:: Can''t instantiate the class! The first argument ' inputname(a) ' must be a 1*2 vector of integers.'])
|
||||
end
|
||||
if b==1 && a(2)~1
|
||||
error(['dynDate:: Can''t instantiate the class! The second element of the first argument ' inputname(a) ' must be equal to one.'])
|
||||
end
|
||||
if a(2)<=0 || a(2)>b
|
||||
error(['dynDate:: Can''t instantiate the class! The second element of the first argument ' inputname(a) ' must be <=' int2str(b) '.' ])
|
||||
end
|
||||
date.time = a;
|
||||
else
|
||||
error(['dynDate:: Can''t instantiate the class! The second argument ' inputname(b) ' must be equal to 1, 4, 12 or 52.'])
|
||||
end
|
||||
otherwise
|
||||
error('dynDate:: Can''t instantiate the class, wrong calling sequence!')
|
||||
end
|
||||
|
@ -137,8 +153,8 @@ end
|
|||
%$ % Define some dates
|
||||
%$ date_1 = 1950;
|
||||
%$ date_2 = '1950Q2';
|
||||
%$ date_3 = '1950M10';
|
||||
%$ date_4 = '1950W50';
|
||||
%$ date_3 = '1950m10';
|
||||
%$ date_4 = '1950w50';
|
||||
%$ date_5 = '1950';
|
||||
%$
|
||||
%$ % Define expected results.
|
||||
|
@ -188,4 +204,37 @@ end
|
|||
%$ t(5) = dyn_assert(all(isnan(mm.time)),1);
|
||||
%$ t(6) = dyn_assert(all(isnan(ww.time)),1);
|
||||
%$ T = all(t);
|
||||
%@eof:1
|
||||
%@eof:2
|
||||
|
||||
%@test:3
|
||||
%$ % Try to instatiate dynDate objects.
|
||||
%$ try
|
||||
%$ a = dynDate([1950 1],4);
|
||||
%$ t(1) = 1;
|
||||
%$ catch
|
||||
%$ t(1) = 0;
|
||||
%$ end
|
||||
%$ try
|
||||
%$ a = dynDate([1950 5],4);
|
||||
%$ t(1) = 0;
|
||||
%$ catch
|
||||
%$ t(1) = 1;
|
||||
%$ end
|
||||
%$ T = all(t);
|
||||
%@eof:3
|
||||
|
||||
%@test:4
|
||||
%$ % Instatiate an empty objects for quaterly, monthly and weekly dates.
|
||||
%$ qq = dynDate('q');
|
||||
%$ mm = dynDate('m');
|
||||
%$ ww = dynDate('w');
|
||||
%$
|
||||
%$ % Check the results.
|
||||
%$ t(1) = dyn_assert(qq.freq,4);
|
||||
%$ t(2) = dyn_assert(mm.freq,12);
|
||||
%$ t(3) = dyn_assert(ww.freq,52);
|
||||
%$ t(4) = dyn_assert(all(isnan(qq.time)),1);
|
||||
%$ t(5) = dyn_assert(all(isnan(mm.time)),1);
|
||||
%$ t(6) = dyn_assert(all(isnan(ww.time)),1);
|
||||
%$ T = all(t);
|
||||
%@eof:4
|
||||
|
|
|
@ -46,8 +46,6 @@ function c = eq(a,b)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if nargin~=2
|
||||
error('dynDate::eq: I need exactly two input arguments!')
|
||||
end
|
||||
|
@ -57,14 +55,13 @@ if ~( isa(a,'dynDate') && isa(b,'dynDate'))
|
|||
end
|
||||
|
||||
if ~isequal(a.freq,b.freq)
|
||||
error(['dynDate::eq: Input arguments ' inputname(1) 'and ' inputname(2) ' have no common frequencies!'])
|
||||
c = 0;
|
||||
return
|
||||
end
|
||||
|
||||
c = isequal(a.time,b.time);
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_1 = 1950;
|
||||
%$ date_2 = '1950Q2';
|
||||
|
@ -80,10 +77,11 @@ c = isequal(a.time,b.time);
|
|||
%$ d5 = dynDate(date_5);
|
||||
%$ try
|
||||
%$ i1 = (d1==d2);
|
||||
%$ t1 = 0;
|
||||
%$ catch
|
||||
%$ t1 = 1;
|
||||
%$ catch
|
||||
%$ t1 = 0;
|
||||
%$ end
|
||||
%$ t1 = t1 & ~i1;
|
||||
%$ i2 = (d2==d2);
|
||||
%$ i3 = (d4==d5);
|
||||
%$
|
||||
|
@ -94,3 +92,33 @@ c = isequal(a.time,b.time);
|
|||
%$ T = all(t);
|
||||
%@eof:1
|
||||
|
||||
%@test:2
|
||||
%$ % Define some dates
|
||||
%$ date_1 = 1950;
|
||||
%$ date_2 = '1950q2';
|
||||
%$ date_3 = '1950m10';
|
||||
%$ date_4 = '1950w50';
|
||||
%$ date_5 = '1950w32';
|
||||
%$
|
||||
%$ % Call the tested routine.
|
||||
%$ d1 = dynDate(date_1);
|
||||
%$ d2 = dynDate(date_2);
|
||||
%$ d3 = dynDate(date_3);
|
||||
%$ d4 = dynDate(date_4);
|
||||
%$ d5 = dynDate(date_5);
|
||||
%$ try
|
||||
%$ i1 = (d1==d2);
|
||||
%$ t1 = 1;
|
||||
%$ catch
|
||||
%$ t1 = 0;
|
||||
%$ end
|
||||
%$ t1 = t1 & ~i1;
|
||||
%$ i2 = (d2==d2);
|
||||
%$ i3 = (d4==d5);
|
||||
%$
|
||||
%$ % Check the results.
|
||||
%$ t(1) = t1;
|
||||
%$ t(2) = dyn_assert(i2,1);
|
||||
%$ t(3) = dyn_assert(i3,0);
|
||||
%$ T = all(t);
|
||||
%@eof:2
|
|
@ -69,8 +69,6 @@ switch date.freq
|
|||
end
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_1 = 1950;
|
||||
%$ date_2 = '1950Q2';
|
||||
|
|
|
@ -30,7 +30,7 @@ function c = ge(a,b)
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
% Copyright (C) 2011, 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -47,8 +47,6 @@ function c = ge(a,b)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if a>b
|
||||
c=1;
|
||||
else
|
||||
|
@ -60,8 +58,6 @@ else
|
|||
end
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_1 = '1950Q3';
|
||||
%$ date_2 = '1950Q3';
|
||||
|
|
|
@ -46,8 +46,6 @@ function c = gt(a,b)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if nargin~=2
|
||||
error('dynDate::eq: I need exactly two input arguments!')
|
||||
end
|
||||
|
@ -73,8 +71,6 @@ else
|
|||
end
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_1 = 1950;
|
||||
%$ date_2 = '1950Q2';
|
||||
|
|
|
@ -27,7 +27,7 @@ function b = isempty(a)
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2012 Dynare Team
|
||||
% Copyright (C) 2012, 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -44,10 +44,16 @@ function b = isempty(a)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if ~isa(a,'dynDate')
|
||||
error(['dynDate::isempty: Input argument ' inputname(1) ' have to be a dynDate object!'])
|
||||
end
|
||||
|
||||
b = all(isnan(a.time)) && isnan(a.freq);
|
||||
|
||||
%@test:1
|
||||
%$ % Instantiate an empty dynDate object
|
||||
%$ d = dynDate();
|
||||
%$ % Test if this object is empty
|
||||
%$ t(1) = isempty(d);
|
||||
%$ T = all(t);
|
||||
%@eof:1
|
|
@ -30,7 +30,7 @@ function c = le(a,b)
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
% Copyright (C) 2011, 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -47,8 +47,6 @@ function c = le(a,b)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if a<b
|
||||
c=1;
|
||||
else
|
||||
|
@ -60,8 +58,6 @@ else
|
|||
end
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_1 = '1950Q3';
|
||||
%$ date_2 = '1950Q3';
|
||||
|
|
|
@ -46,8 +46,6 @@ function c = lt(a,b)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if nargin~=2
|
||||
error('dynDate::eq: I need exactly two input arguments!')
|
||||
end
|
||||
|
@ -73,8 +71,6 @@ else
|
|||
end
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_1 = 1950;
|
||||
%$ date_2 = '1950Q2';
|
||||
|
|
|
@ -46,8 +46,6 @@ function c = max(a,b)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if nargin~=2
|
||||
error('dynDate::min: I need exactly two input arguments!')
|
||||
end
|
||||
|
@ -67,14 +65,12 @@ else
|
|||
end
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_1 = 1950;
|
||||
%$ date_2 = 2000;
|
||||
%$ date_3 = '1950Q2';
|
||||
%$ date_3 = '1950q2';
|
||||
%$ date_4 = '1950Q3';
|
||||
%$ date_5 = '1950M1';
|
||||
%$ date_5 = '1950m1';
|
||||
%$ date_6 = '1948M6';
|
||||
%$
|
||||
%$ % Call the tested routine.
|
||||
|
|
|
@ -46,8 +46,6 @@ function c = min(a,b)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if nargin~=2
|
||||
error('dynDate::min: I need exactly two input arguments!')
|
||||
end
|
||||
|
@ -67,8 +65,6 @@ else
|
|||
end
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_1 = 1950;
|
||||
%$ date_2 = 2000;
|
||||
|
|
|
@ -31,7 +31,7 @@ function c = minus(a,b)
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
% Copyright (C) 2011, 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -48,8 +48,6 @@ function c = minus(a,b)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if ~( isa(a,'dynDate') && isa(b,'dynDate') )
|
||||
error(['dynDate::minus: Input arguments ' inputname(1) ' and ' inputname(2) ' must be dynDate objects!'])
|
||||
end
|
||||
|
@ -77,8 +75,6 @@ switch a.freq
|
|||
end
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_0_1 = 1950;
|
||||
%$ date_0_2 = 1950;
|
||||
|
|
|
@ -46,8 +46,6 @@ function c = ne(a,b)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if nargin~=2
|
||||
error('dynDate::ne: I need exactly two input arguments!')
|
||||
end
|
||||
|
@ -63,11 +61,9 @@ end
|
|||
c = ~isequal(a.time,b.time);
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_1 = 1950;
|
||||
%$ date_2 = '1950Q2';
|
||||
%$ date_2 = '1950q2';
|
||||
%$ date_3 = '1950M10';
|
||||
%$ date_4 = '1950W50';
|
||||
%$ date_5 = '1950W32';
|
||||
|
|
|
@ -31,7 +31,7 @@ function c = plus(a,b)
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
% Copyright (C) 2011, 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -48,8 +48,6 @@ function c = plus(a,b)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% AUTHORS(S) stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if ~isa(a,'dynDate')
|
||||
error(['dynDate::plus: Input argument ' inputname(1) ' must be a dynDate object!'])
|
||||
end
|
||||
|
@ -58,7 +56,6 @@ if b<0 || ~isint(b)
|
|||
error(['dynDate::plus: Input argument ' inputname(2) ' must be a positive integer'])
|
||||
end
|
||||
|
||||
|
||||
if b==0
|
||||
c = a;
|
||||
return
|
||||
|
@ -80,8 +77,6 @@ switch a.freq
|
|||
end
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_1 = 1950;
|
||||
%$ date_2 = '1950Q4';
|
||||
|
|
|
@ -17,5 +17,4 @@ function val = subsasgn(val, idx, rhs)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
error('Members of dynDate class are private')
|
||||
end
|
||||
error('dynDate::subsasgn: Members of dynDate class are private')
|
|
@ -32,7 +32,7 @@ function B = subsref(A,S)
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2011, 2012 Dynare Team
|
||||
% Copyright (C) 2011, 2012, 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -49,75 +49,98 @@ function B = subsref(A,S)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
% Allow to populate an empty dynDate object or update a dynDate object
|
||||
if isequal(length(S),1) && isequal(S.type,'()')
|
||||
if isequal(length(S.subs),1) && ischar(S.subs{1})
|
||||
B = dynDate(S.subs{1});
|
||||
return
|
||||
elseif isequal(length(S.subs),1) && isnumeric(S.subs{1})
|
||||
% Yearly data are assumed.
|
||||
if isequal(A.freq,1)
|
||||
B = dynDate(S.subs{1});
|
||||
return
|
||||
end
|
||||
elseif isequal(length(S.subs),2) && isequal(length(S.subs{1}),1) && isequal(length(S.subs{2}),1)
|
||||
tmp = [];
|
||||
switch A.freq
|
||||
case 4
|
||||
% Quaterly data
|
||||
if S.subs{2}<5 && S.subs{2}>0
|
||||
tmp = [num2str(S.subs{1}), 'Q' num2str(S.subs{2})];
|
||||
end
|
||||
case 12
|
||||
% Monthly data
|
||||
if S.subs{2}<13 && S.subs{2}>0
|
||||
tmp = [num2str(S.subs{1}), 'M' num2str(S.subs{2})];
|
||||
end
|
||||
case 52
|
||||
% Weekly data
|
||||
if S.subs{2}<53 && S.subs{2}>0
|
||||
tmp = [num2str(S.subs{1}), 'W' num2str(S.subs{2})];
|
||||
end
|
||||
otherwise
|
||||
%
|
||||
end
|
||||
if ~isempty(tmp)
|
||||
B = dynDate(tmp);
|
||||
return
|
||||
end
|
||||
switch S(1).type
|
||||
case '.'
|
||||
switch S(1).subs
|
||||
case 'format'
|
||||
B = format(A);
|
||||
case {'time', 'freq'}
|
||||
B = builtin('subsref', A, S(1));
|
||||
otherwise
|
||||
error('dynDate::subsref: Unknown public member of method!')
|
||||
end
|
||||
case '()'
|
||||
switch length(S(1).subs)
|
||||
case 1
|
||||
if ischar(S(1).subs{1})
|
||||
if numel(S(1).subs{1})==1 && isempty(strmatch(S(1).subs{1},{'W','M','Q','Y'},'exact'))
|
||||
error(['dynDate::subsref: To set the frequency, the input argument of dynDate object ''' inputname(1) ''' should be ''W'', ''M'', ''Q'' or ''Y''.'])
|
||||
end
|
||||
% Set the frequency (if numel==1) of an empty dynDate object or set the date (if numel>1).
|
||||
B = dynDate(S(1).subs{1});
|
||||
elseif isnumeric(S(1).subs{1}) && isscalar(S(1).subs{1}) && isint(S(1).subs{1})
|
||||
if (~isnan(A.freq) && A.freq==1) || isnan(A.freq)
|
||||
B = dynDate(S(1).subs{1});
|
||||
else
|
||||
error(['dynDate::subsref: dynDate object ''' inputname(1) ''' was not instantiated for years.'])
|
||||
end
|
||||
else
|
||||
error('dynDate::subsref: Something is wrong in your syntax!')
|
||||
end
|
||||
case 2% Populate an empty dynDate object
|
||||
if isnan(A.freq)
|
||||
error(['dynDate::subsref: I cannot interpret the two inputs of dynDate object ''' inputname(1) ''' because frequency is not set.'])
|
||||
else
|
||||
tmp = [];
|
||||
switch A.freq
|
||||
case 4
|
||||
% Quaterly data
|
||||
if isint(S(1).subs{2}) && isint(S(1).subs{1}) && S(1).subs{2}<5 && S(1).subs{2}>0
|
||||
tmp = [int2str(S(1).subs{1}), 'Q' int2str(S(1).subs{2})];
|
||||
else
|
||||
if ~isint(S(1).subs{2}) || ~(S(1).subs{2}<5 && S(1).subs{2}>0)
|
||||
error(['dynDate::subsref: The second input argument of dynDate object ''' inputname(1) ''' (' num2str(S(1).subs{2}) ') should be a positive integer less than or equal to 4.'])
|
||||
end
|
||||
if ~isint(S(1).subs{2})
|
||||
error(['dynDate::subsref: The first input argument of dynDate object ''' inputname(1) ''' (' num2str(S(1).subs{1}) ') should be an integer.'])
|
||||
end
|
||||
end
|
||||
case 12
|
||||
% Monthly data
|
||||
if isint(S(1).subs{2}) && isint(S(1).subs{1}) && S(1).subs{2}<13 && S(1).subs{2}>0
|
||||
tmp = [num2str(S(1).subs{1}), 'M' num2str(S(1).subs{2})];
|
||||
else
|
||||
if ~isint(S(1).subs{2}) || ~(S(1).subs{2}<13 && S(1).subs{2}>0)
|
||||
error(['dynDate::subsref: The second input argument of dynDate object ''' inputname(1) ''' (' num2str(S(1).subs{2}) ') should be a positive integer less than or equal to 12.'])
|
||||
end
|
||||
if ~isint(S(1).subs{2})
|
||||
error(['dynDate::subsref: The first input argument of dynDate object ''' inputname(1) ''' (' num2str(S(1).subs{1}) ') should be an integer.'])
|
||||
end
|
||||
end
|
||||
case 52
|
||||
% Weekly data
|
||||
if isint(S(1).subs{2}) && isint(S(1).subs{1}) && S(1).subs{2}<53 && S(1).subs{2}>0
|
||||
tmp = [num2str(S(1).subs{1}), 'W' num2str(S(1).subs{2})];
|
||||
else
|
||||
if ~isint(S(1).subs{2}) || ~(S(1).subs{2}<53 && S(1).subs{2}>0)
|
||||
error(['dynDate::subsref: The second input argument of dynDate object ''' inputname(1) ''' (' num2str(S(1).subs{2}) ') should be a positive integer less than or equal to 52.'])
|
||||
end
|
||||
if ~isint(S(1).subs{2})
|
||||
error(['dynDate::subsref: The first input argument of dynDate object ''' inputname(1) ''' (' num2str(S(1).subs{1}) ') should be an integer.'])
|
||||
end
|
||||
end
|
||||
case 1
|
||||
% Yearly data
|
||||
error('dynDate::subsref: Frequency is set for years. You should not provide more than one integer input argument (to set the year)!')
|
||||
otherwise
|
||||
error('dynDate::subsref: Unknown frequency!')
|
||||
end
|
||||
if ~isempty(tmp)
|
||||
B = dynDate(tmp);
|
||||
end
|
||||
end
|
||||
otherwise
|
||||
error(['dynDate::subsref: dynDate object ''' inputname(1) ''' cannot have more than two inputs.'])
|
||||
end
|
||||
otherwise
|
||||
error('dynDate::subsref: Something is wrong in your syntax!')
|
||||
end
|
||||
|
||||
% Give access to dynDate methods (format).
|
||||
if isequal(length(S),1) && isequal(S.type,'.') && ( strcmp(S.subs,'format') )
|
||||
B = format(A);
|
||||
return
|
||||
S = shiftS(S);
|
||||
if ~isempty(S)
|
||||
B = subsref(B, S);
|
||||
end
|
||||
|
||||
|
||||
% Give access to dynDate properties (time and freq).
|
||||
if isequal(length(S),1) && isequal(S.type,'.') && ( strcmp(S.subs,'time') || strcmp(S.subs,'freq') )
|
||||
B = builtin('subsref', A, S);
|
||||
return
|
||||
end
|
||||
|
||||
% Allow more complex call to subsref such that:
|
||||
%
|
||||
% a = dynDate();
|
||||
% a('2009M4').time
|
||||
%
|
||||
% should return a row vector [2009 4]. Note that the object name should not match any function name
|
||||
% declared in the matlab's path.
|
||||
if length(S)>1 && isequal(S(1).type,'()') && isequal(S(2).type,'.')
|
||||
tmp = dynDate(S(1).subs{1});
|
||||
B = builtin('subsref', tmp, S(2));
|
||||
return
|
||||
end
|
||||
|
||||
error('dynDate::subsref: You''re trying to do something wrong!')
|
||||
|
||||
%@test:1
|
||||
%$ t = zeros(3,1);
|
||||
%$
|
||||
|
@ -168,11 +191,13 @@ error('dynDate::subsref: You''re trying to do something wrong!')
|
|||
|
||||
%@test:3
|
||||
%$ % Try more complex call to overloaded subsref
|
||||
%$ t = zeros(1,1);
|
||||
%$ t = zeros(3,1);
|
||||
%$ try
|
||||
%$ a = dynDate();
|
||||
%$ a = dynDate('M');
|
||||
%$ time = a('1973M1').time;
|
||||
%$ t(1) = 1;
|
||||
%$ t(2) = dyn_assert(time,[1973,1]);
|
||||
%$ t(3) = dyn_assert(a.freq,12);
|
||||
%$ catch
|
||||
%$ % Nothing to do here.
|
||||
%$ end
|
||||
|
@ -180,7 +205,6 @@ error('dynDate::subsref: You''re trying to do something wrong!')
|
|||
%$ T = all(t);
|
||||
%@eof:3
|
||||
|
||||
|
||||
%@test:4
|
||||
%$ t = NaN(3,1);
|
||||
%$ % Instantiate an empty object for quaterly date
|
||||
|
@ -198,4 +222,17 @@ error('dynDate::subsref: You''re trying to do something wrong!')
|
|||
%$ t(1) = dyn_assert(a.freq,4);
|
||||
%$ t(2) = dyn_assert(a.time,[1938,4]);
|
||||
%$ T = all(t);
|
||||
%@eof:3
|
||||
%@eof:4
|
||||
|
||||
%@test:5
|
||||
%$ t = NaN(2,1);
|
||||
%$ % Instantiate an empty object for quaterly date
|
||||
%$ qq = dynDate('Q');
|
||||
%$ % Populate this object and get the time member
|
||||
%$ time = qq(1938,4).time;
|
||||
%$
|
||||
%$ % Check the results
|
||||
%$ t(1) = dyn_assert(qq.freq,4);
|
||||
%$ t(2) = dyn_assert(time,[1938,4]);
|
||||
%$ T = all(t);
|
||||
%@eof:5
|
|
@ -29,7 +29,7 @@ function b = uminus(a)
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
% Copyright (C) 2011, 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -46,8 +46,6 @@ function b = uminus(a)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if ~isa(a,'dynDate')
|
||||
error(['dynDate::uminus: Input argument ' inputname(1) ' must be a dynDate object.'])
|
||||
end
|
||||
|
@ -83,14 +81,12 @@ switch b.freq
|
|||
end
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_1 = '1950Q1';
|
||||
%$ date_2 = '1950Q4';
|
||||
%$ date_3 = '1950M1';
|
||||
%$ date_4 = '1950M12';
|
||||
%$ date_5 = '1950W1';
|
||||
%$ date_5 = '1950w1';
|
||||
%$ date_6 = '1950W52';
|
||||
%$ date_7 = 2000;
|
||||
%$
|
||||
|
|
|
@ -29,7 +29,7 @@ function b = uplus(a)
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
% Copyright (C) 2011, 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -46,8 +46,6 @@ function b = uplus(a)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if ~isa(a,'dynDate')
|
||||
error(['dynDate::uplus: Input argument ' inputname(1) ' must be a dynDate object.'])
|
||||
end
|
||||
|
@ -83,13 +81,11 @@ switch b.freq
|
|||
end
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ date_1 = '1950Q3';
|
||||
%$ date_2 = '1950Q4';
|
||||
%$ date_3 = '1950M3';
|
||||
%$ date_4 = '1950M12';
|
||||
%$ date_4 = '1950m12';
|
||||
%$ date_5 = '1950W3';
|
||||
%$ date_6 = '1950W52';
|
||||
%$ date_7 = 2000;
|
||||
|
|
|
@ -97,3 +97,27 @@ end
|
|||
%$ t(3) = dyn_assert(d.ndat,e.ndat);
|
||||
%$ T = all(t);
|
||||
%@eof:1
|
||||
|
||||
%@test:2
|
||||
%$ % Define some dates
|
||||
%$ B1 = '1953Q4';
|
||||
%$ B2 = '1950Q2';
|
||||
%$ B3 = '1950Q1';
|
||||
%$ B4 = '1945Q3';
|
||||
%$ B5 = '2009q2';
|
||||
%$
|
||||
%$ % Define expected results.
|
||||
%$ e.time = [1945 3; 1950 1; 1950 2; 1953 4; 2009 2];
|
||||
%$ e.freq = 4;
|
||||
%$ e.ndat = 5;
|
||||
%$
|
||||
%$ % Call the tested routine.
|
||||
%$ d = dynDates(B4,B3,B2,B1);
|
||||
%$ d = d.append(B5);
|
||||
%$
|
||||
%$ % Check the results.
|
||||
%$ t(1) = dyn_assert(d.time,e.time);
|
||||
%$ t(2) = dyn_assert(d.freq,e.freq);
|
||||
%$ t(3) = dyn_assert(d.ndat,e.ndat);
|
||||
%$ T = all(t);
|
||||
%@eof:2
|
|
@ -45,7 +45,7 @@ function dd = dynDates(varargin)
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2011 Dynare Team
|
||||
% Copyright (C) 2011-2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -60,15 +60,13 @@ function dd = dynDates(varargin)
|
|||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
dd = struct;
|
||||
|
||||
dd.ndat = 0;
|
||||
dd.freq = [];
|
||||
dd.time = [];
|
||||
dd.freq = NaN;
|
||||
dd.time = NaN(1,2);
|
||||
|
||||
dd = class(dd,'dynDates');
|
||||
|
||||
|
@ -104,12 +102,10 @@ switch nargin
|
|||
end
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ B1 = '1945Q3';
|
||||
%$ B2 = '1950Q2';
|
||||
%$ B3 = '1950Q1';
|
||||
%$ B3 = '1950q1';
|
||||
%$ B4 = '1953Q4';
|
||||
%$
|
||||
%$ % Define expected results.
|
||||
|
@ -128,8 +124,6 @@ end
|
|||
%@eof:1
|
||||
|
||||
%@test:2
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ B1 = '1945M3';
|
||||
%$ B2 = '1950M2';
|
||||
|
@ -152,8 +146,6 @@ end
|
|||
%@eof:2
|
||||
|
||||
%@test:3
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ B1 = '1945';
|
||||
%$ B2 = '1950';
|
||||
|
@ -176,23 +168,21 @@ end
|
|||
%@eof:3
|
||||
|
||||
%@test:4
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ B1 = '1945Q1';
|
||||
%$ B2 = '1950Q3';
|
||||
%$ B3 = '1950M10';
|
||||
%$ B4 = '1953Q1';
|
||||
%$ % Define a dynDates object
|
||||
%$ B = dynDate('1950Q1'):dynDate('1960Q3');
|
||||
%$
|
||||
%$
|
||||
%$ % Call the tested routine.
|
||||
%$ try
|
||||
%$ d = dynDates(B1,B2,B3,B4);
|
||||
%$ t(1) = 0;
|
||||
%$ T = 0;
|
||||
%$ catch
|
||||
%$ % Expected issue...
|
||||
%$ d = B(2);
|
||||
%$ if isa(d,'dynDate')
|
||||
%$ t(1) = 1;
|
||||
%$ T = 1;
|
||||
%$ else
|
||||
%$ t(1) = 0;
|
||||
%$ end
|
||||
%$
|
||||
%$ if t(1)
|
||||
%$ t(2) = dyn_assert(d.freq,B.freq);
|
||||
%$ t(3) = dyn_assert(d.time,[1950 2]);
|
||||
%$ end
|
||||
%$ T = all(t);
|
||||
%@eof:4
|
|
@ -0,0 +1,80 @@
|
|||
function C = eq(A,B)
|
||||
|
||||
%@info:
|
||||
%! @deftypefn {Function File} {@var{C} =} eq (@var{A},@var{B})
|
||||
%! @anchor{@dynDates/eq}
|
||||
%! @sp 1
|
||||
%! Overloads the eq (equal) operator for the @ref{dynDates} class.
|
||||
%! @sp 2
|
||||
%! @strong{Inputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item A
|
||||
%! @ref{dynDates} object.
|
||||
%! @item B
|
||||
%! @ref{dynDates} object.
|
||||
%! @end table
|
||||
%! @sp 1
|
||||
%! @strong{Outputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item C
|
||||
%! scalar integer equal to one if a==b, 0 otherwise.
|
||||
%! @end table
|
||||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if nargin~=2
|
||||
error('dynDates::eq: I need exactly two input arguments!')
|
||||
end
|
||||
|
||||
if ~isa(A,'dynDates') || ~isa(B,'dynDates')
|
||||
error(['dynDates::eq: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' have to be a dynDates objects!'])
|
||||
end
|
||||
|
||||
if ~isequal(A.freq,B.freq)
|
||||
C = 0;
|
||||
return
|
||||
end
|
||||
|
||||
if ~isequal(A.ndat,B.ndat)
|
||||
C = 0;
|
||||
return
|
||||
end
|
||||
|
||||
C = isequal(A.time,B.time);
|
||||
|
||||
%@test:1
|
||||
%$ % Define some dynDates objects
|
||||
%$ d1 = dynDate('1950Q1'):dynDate('1959Q4') ;
|
||||
%$ d2 = dynDate('1960Q1'):dynDate('1979Q4') ;
|
||||
%$ d3 = dynDate('1970M1'):dynDate('1979M12') ;
|
||||
%$
|
||||
%$ % Call the tested routine.
|
||||
%$ t1 = d1==d1;
|
||||
%$ t2 = d1==d2;
|
||||
%$ t3 = d1==d3;
|
||||
%$
|
||||
%$ % Check the results.
|
||||
%$ t(1) = dyn_assert(t1,1);
|
||||
%$ t(2) = dyn_assert(t2,0);
|
||||
%$ t(2) = dyn_assert(t3,0);
|
||||
%$ T = all(t);
|
||||
%@eof:1
|
|
@ -0,0 +1,84 @@
|
|||
function C = intersect(A,B)
|
||||
|
||||
%@info:
|
||||
%! @deftypefn {Function File} {@var{C} =} intersect (@var{A},@var{B})
|
||||
%! @anchor{@dynDates/intersect}
|
||||
%! @sp 1
|
||||
%! C of B and A.
|
||||
%! if A and B are not disjoints.
|
||||
%! @sp 2
|
||||
%! @strong{Inputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item A
|
||||
%! @ref{dynDates} object.
|
||||
%! @item B
|
||||
%! @ref{dynDates} object.
|
||||
%! @end table
|
||||
%! @sp 2
|
||||
%! @strong{Outputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item C
|
||||
%! @ref{dynDates} object.
|
||||
%! @end table
|
||||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if ~isa(A,'dynDates') || ~isa(B,'dynDates')
|
||||
error(['dynDates::plus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must be dynDates objects!'])
|
||||
end
|
||||
|
||||
if eq(A,B)
|
||||
C = A;
|
||||
return
|
||||
end
|
||||
|
||||
if ~isequal(A.freq,B.freq)
|
||||
C = dynDates();
|
||||
return
|
||||
end
|
||||
|
||||
time = intersect(A.time,B.time,'rows');
|
||||
|
||||
C = dynDates();
|
||||
if isempty(time)
|
||||
return
|
||||
end
|
||||
|
||||
C.freq = A.freq;
|
||||
C.time = time;
|
||||
C.ndat = rows(time);
|
||||
|
||||
%@test:1
|
||||
%$ % Define some dynDates objects
|
||||
%$ d1 = dynDate('1950Q1'):dynDate('1969Q4') ;
|
||||
%$ d2 = dynDate('1960Q1'):dynDate('1969Q4') ;
|
||||
%$ d3 = dynDate('1970Q1'):dynDate('1979Q4') ;
|
||||
%$
|
||||
%$ % Call the tested routine.
|
||||
%$ c1 = intersect(d1,d2);
|
||||
%$ c2 = intersect(d1,d3);
|
||||
%$
|
||||
%$ % Check the results.
|
||||
%$ t(1) = dyn_assert(c1==d2,1);
|
||||
%$ t(2) = dyn_assert(isempty(c2),1);
|
||||
%$ T = all(t);
|
||||
%@eof:1
|
|
@ -0,0 +1,50 @@
|
|||
function B = isempty(A)
|
||||
|
||||
%@info:
|
||||
%! @deftypefn {Function File} {@var{B} =} isempty (@var{A})
|
||||
%! @anchor{@dynDates/isempty}
|
||||
%! @sp 1
|
||||
%! Overloads the isempty function for the @ref{dynDates} class.
|
||||
%! @sp 2
|
||||
%! @strong{Inputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item A
|
||||
%! @ref{dynDates} object.
|
||||
%! @end table
|
||||
%! @sp 1
|
||||
%! @strong{Outputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item b
|
||||
%! Integer scalar (equal to zero if @var{A} is not empty).
|
||||
%! @end table
|
||||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
B = all(isnan(A.time(:))) && isnan(A.freq) && isequal(A.ndat,0);
|
||||
|
||||
%@test:1
|
||||
%$ % Instantiate an empty dynDate object
|
||||
%$ d = dynDates();
|
||||
%$ % Test if this object is empty
|
||||
%$ t(1) = isempty(d);
|
||||
%$ T = all(t);
|
||||
%@eof:1
|
|
@ -0,0 +1,85 @@
|
|||
function C = minus(A,B)
|
||||
|
||||
%@info:
|
||||
%! @deftypefn {Function File} {@var{C} =} minus (@var{A},@var{B})
|
||||
%! @anchor{@dynDates/minus}
|
||||
%! @sp 1
|
||||
%! Overloads the minus (soustraction) operator for the @ref{dynDates} class. C is the relative complement of B in A.
|
||||
%! if A and B are not disjoints.
|
||||
%! @sp 2
|
||||
%! @strong{Inputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item A
|
||||
%! @ref{dynDates} object.
|
||||
%! @item B
|
||||
%! @ref{dynDates} object.
|
||||
%! @end table
|
||||
%! @sp 2
|
||||
%! @strong{Outputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item C
|
||||
%! @ref{dynDates} object.
|
||||
%! @end table
|
||||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if isempty(B)
|
||||
C = A;
|
||||
return
|
||||
end
|
||||
|
||||
if isempty(A)
|
||||
C = dynDates();
|
||||
return
|
||||
end
|
||||
|
||||
if ~isequal(A.freq,B.freq)
|
||||
C = A;
|
||||
return
|
||||
end
|
||||
|
||||
D = intersect(A,B);
|
||||
|
||||
if isempty(D)
|
||||
C = A;
|
||||
else
|
||||
C = dynDates();
|
||||
C.freq = A.freq;
|
||||
C.time = setdiff(A.time,D.time,'rows');
|
||||
C.ndat = rows(C.time);
|
||||
end
|
||||
|
||||
%@test:1
|
||||
%$ % Define some dynDates objects
|
||||
%$ d1 = dynDate('1950Q1'):dynDate('1959Q4') ;
|
||||
%$ d2 = dynDate('1960Q1'):dynDate('1969Q4') ;
|
||||
%$ d3 = d1+d2;
|
||||
%$
|
||||
%$ % Call the tested routine.
|
||||
%$ e1 = d1-d2;
|
||||
%$ e2 = d3-d1;
|
||||
%$
|
||||
%$ % Check the results.
|
||||
%$ t(1) = dyn_assert(e1==d1,1);
|
||||
%$ t(2) = dyn_assert(e2==d2,1);
|
||||
%$ T = all(t);
|
||||
%@eof:1
|
|
@ -0,0 +1,87 @@
|
|||
function C = plus(A,B)
|
||||
|
||||
%@info:
|
||||
%! @deftypefn {Function File} {@var{C} =} plus (@var{A},@var{B})
|
||||
%! @anchor{@dynDates/plus}
|
||||
%! @sp 1
|
||||
%! Overloads the plus (addition) operator for the @ref{dynDates} class. Combines two dynDates objects, A and B, without removing repetitions
|
||||
%! if A and B are not disjoints.
|
||||
%! @sp 2
|
||||
%! @strong{Inputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item A
|
||||
%! @ref{dynDates} object.
|
||||
%! @item B
|
||||
%! @ref{dynDates} object.
|
||||
%! @end table
|
||||
%! @sp 2
|
||||
%! @strong{Outputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item C
|
||||
%! @ref{dynDates} object.
|
||||
%! @end table
|
||||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if ~isa(A,'dynDates') || ~isa(B,'dynDates')
|
||||
error(['dynDates::plus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must be dynDates objects!'])
|
||||
end
|
||||
|
||||
if isempty(B)
|
||||
C = A;
|
||||
return
|
||||
end
|
||||
|
||||
if isempty(A)
|
||||
C = B;
|
||||
return
|
||||
end
|
||||
|
||||
if ~isequal(A.freq,B.freq)
|
||||
error(['dynDates::plus: Input arguments ''' inputname(1) ''' and ''' inputname(2) ''' must have common frequencies!'])
|
||||
end
|
||||
|
||||
C = dynDates();
|
||||
|
||||
C.freq = A.freq;
|
||||
C.time = [A.time; B.time];
|
||||
C.ndat = A.ndat+B.ndat;
|
||||
|
||||
%@test:1
|
||||
%$ % Define some dynDates objects
|
||||
%$ d1 = dynDate('1950Q1'):dynDate('1959Q4') ;
|
||||
%$ d2 = dynDate('1960Q1'):dynDate('1969Q4') ;
|
||||
%$ d3 = dynDate('1970Q1'):dynDate('1979Q4') ;
|
||||
%$
|
||||
%$ % Call the tested routine.
|
||||
%$ e1 = d1+d2;
|
||||
%$ e2 = d1+d2+d3;
|
||||
%$
|
||||
%$ % Expected results.
|
||||
%$ f1 = dynDate('1950Q1'):dynDate('1969Q4');
|
||||
%$ f2 = dynDate('1950Q1'):dynDate('1979Q4');
|
||||
%$
|
||||
%$ % Check the results.
|
||||
%$ t(1) = dyn_assert(e1==f1,1);
|
||||
%$ t(2) = dyn_assert(e2==f2,1);
|
||||
%$ T = all(t);
|
||||
%@eof:1
|
|
@ -45,8 +45,6 @@ function dd = sort(dd)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if ~isa(dd,'dynDates')
|
||||
error(['dynDates::sort: Input argument ' inputname(dd) ' has to be a dynDates object.'])
|
||||
end
|
||||
|
@ -58,8 +56,6 @@ end
|
|||
dd.time = sortrows(dd.time,[1,2]);
|
||||
|
||||
%@test:1
|
||||
%$ addpath ../matlab
|
||||
%$
|
||||
%$ % Define some dates
|
||||
%$ B1 = '1953Q4';
|
||||
%$ B2 = '1950Q2';
|
||||
|
@ -73,7 +69,7 @@ dd.time = sortrows(dd.time,[1,2]);
|
|||
%$
|
||||
%$ % Call the tested routine.
|
||||
%$ d = dynDates(B1,B2,B3,B4);
|
||||
%$ d = d.sort();
|
||||
%$ d = d.sort;
|
||||
%$
|
||||
%$ % Check the results.
|
||||
%$ t(1) = dyn_assert(d.time,e.time);
|
||||
|
|
|
@ -17,5 +17,4 @@ function val = subsasgn(val, idx, rhs)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
error('Members of dynDates class are private')
|
||||
end
|
||||
error('dynDates::subsasgn: Members of dynDates class are private')
|
|
@ -49,30 +49,88 @@ function B = subsref(A,S)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if isequal(S(1).type,'.')
|
||||
switch S(1).type
|
||||
case '.'
|
||||
switch S(1).subs
|
||||
case {'time','freq','ndat'} % Public members.
|
||||
case {'time','freq','ndat'}% Access public members.
|
||||
B = builtin('subsref', A, S(1));
|
||||
case {'sort','append','pop','unique'} % Give "dot access" to public methods.
|
||||
if length(S)==1 || (strcmp(S(2).type,'()') && isempty(S(2).subs))
|
||||
B = feval(S(1).subs,A);
|
||||
case {'sort','unique'}% Public methods (without arguments)
|
||||
B = feval(S(1).subs,A);
|
||||
case {'append','pop'}% Public methods (with arguments).
|
||||
if isequal(S(2).type,'()')
|
||||
B = feval(S(1).subs,A,S(2).subs{:});
|
||||
S = shiftS(S);
|
||||
else
|
||||
if isequal(S(2).type,'()')
|
||||
B = feval(S(1).subs,A,S(2).subs{:});
|
||||
else
|
||||
error('dynDates::subsref: Something is wrong in your syntax!')
|
||||
end
|
||||
error('dynDates::subsref: Something is wrong in your syntax!')
|
||||
end
|
||||
otherwise
|
||||
error('dynDates::subsref: Unknown public method or member!')
|
||||
error('dynDates::subsref: Unknown public member or method!')
|
||||
end
|
||||
elseif isequal(S.type,'()') % Extract a sub-sample.
|
||||
if length(S.subs)==1
|
||||
S.subs = [S.subs, ':'];
|
||||
case '()'
|
||||
if isscalar(S(1).subs{1})
|
||||
if isint(S(1).subs{1}) && S(1).subs{1}>0 && S(1).subs{1}<A.ndat
|
||||
B = dynDate(A.time(S(1).subs{1},:),A.freq);
|
||||
else
|
||||
error(['dynDates::subsref: the index have to be a positive integer less than or equal to ' int2str(A.ndat) '!'])
|
||||
end
|
||||
else
|
||||
if isvector(S(1).subs{1}) && all(isint(S(1).subs{1})) && all(S(1).subs{1}>0) && all(S(1).subs{1}<A.ndat)
|
||||
B = dynDates();
|
||||
B.freq = A.freq;
|
||||
B.time = A.time(S(1).subs{1},:);
|
||||
B.ndat = length(S(1).subs{1});
|
||||
else
|
||||
error(['dynDates::subsref: indices have to be a vector of positive integers less than or equal to ' int2str(A.ndat) '!'])
|
||||
end
|
||||
end
|
||||
B = builtin('subsref', A.time, S);
|
||||
else
|
||||
otherwise
|
||||
error('dynDates::subsref: Something is wrong in your syntax!')
|
||||
end
|
||||
|
||||
S = shiftS(S);
|
||||
if ~isempty(S)
|
||||
B = subsref(B, S);
|
||||
end
|
||||
|
||||
%@test:1
|
||||
%$ % Define a dynDates object
|
||||
%$ B = dynDate('1950Q1'):dynDate('1960Q3');
|
||||
%$
|
||||
%$ % Try to extract a sub-dynDates object.
|
||||
%$ d = B(2:3);
|
||||
%$
|
||||
%$ if isa(d,'dynDates')
|
||||
%$ t(1) = 1;
|
||||
%$ else
|
||||
%$ t(1) = 0;
|
||||
%$ end
|
||||
%$
|
||||
%$ if t(1)
|
||||
%$ t(2) = dyn_assert(d.freq,B.freq);
|
||||
%$ t(3) = dyn_assert(d.time,[1950 2; 1950 3]);
|
||||
%$ t(4) = dyn_assert(d.ndat,2);
|
||||
%$ end
|
||||
%$ T = all(t);
|
||||
%@eof:1
|
||||
|
||||
%@test:2
|
||||
%$ % Define a dynDates object
|
||||
%$ B = dynDate('1950Q1'):dynDate('1960Q3');
|
||||
%$
|
||||
%$ % Try to extract a sub-dynDates object and apply a method
|
||||
%$
|
||||
%$ d = B(2:3).sort ;
|
||||
%$
|
||||
%$ if isa(d,'dynDates')
|
||||
%$ t(1) = 1;
|
||||
%$ else
|
||||
%$ t(1) = 0;
|
||||
%$ end
|
||||
%$
|
||||
%$ if t(1)
|
||||
%$ t(2) = dyn_assert(d.freq,B.freq);
|
||||
%$ t(3) = dyn_assert(d.time,[1950 2; 1950 3]);
|
||||
%$ t(4) = dyn_assert(d.ndat,2);
|
||||
%$ end
|
||||
%$ T = all(t);
|
||||
%@eof:2
|
|
@ -45,8 +45,6 @@ function dd = unique(dd)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if ~isa(dd,'dynDates')
|
||||
error(['dynDates::unique: Input argument ' inputname(dd) ' has to be a dynDates object.'])
|
||||
end
|
||||
|
@ -63,7 +61,7 @@ dd.ndat = size(dd.time,1);
|
|||
%$ % Define some dates
|
||||
%$ B1 = '1953Q4';
|
||||
%$ B2 = '1950Q2';
|
||||
%$ B3 = '1950Q1';
|
||||
%$ B3 = '1950q1';
|
||||
%$ B4 = '1945Q3';
|
||||
%$ B5 = '1950Q2';
|
||||
%$
|
||||
|
@ -74,7 +72,7 @@ dd.ndat = size(dd.time,1);
|
|||
%$
|
||||
%$ % Call the tested routine.
|
||||
%$ d = dynDates(B1,B2,B3,B4,B5);
|
||||
%$ d = d.unique();
|
||||
%$ d = d.unique;
|
||||
%$
|
||||
%$ % Check the results.
|
||||
%$ t(1) = dyn_assert(d.time,e.time);
|
||||
|
|
|
@ -59,7 +59,7 @@ function ts = dynSeries(varargin)
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2011, 2012 Dynare Team
|
||||
% Copyright (C) 2011, 2012, 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -76,8 +76,6 @@ function ts = dynSeries(varargin)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
ts = struct;
|
||||
|
||||
ts.data = [];
|
||||
|
@ -143,26 +141,8 @@ switch nargin
|
|||
% Get the first date and set the frequency.
|
||||
if ~isempty(b)
|
||||
if ischar(b)% Weekly, Monthly or Quaterly data.
|
||||
quaterly = findstr('Q',b);
|
||||
monthly = findstr('M',b);
|
||||
weekly = findstr('W',b);
|
||||
yearly = findstr('Y',b);
|
||||
if ~isempty(quaterly)
|
||||
ts.freq = 4;
|
||||
end
|
||||
if ~isempty(monthly)
|
||||
ts.freq = 12;
|
||||
end
|
||||
if ~isempty(weekly)
|
||||
ts.freq = 52;
|
||||
end
|
||||
if ~isempty(yearly)
|
||||
ts.freq = 1;
|
||||
end
|
||||
if isempty(quaterly) && isempty(monthly) && isempty(weekly) && isempty(yearly)
|
||||
error('dynSeries:: Using a string as a second input argument, I can only handle weekly (W), monthly (M), quaterly (Q) or yearly (Y) data!');
|
||||
end
|
||||
ts.init = dynDate(b);
|
||||
ts.freq = ts.init.freq;
|
||||
elseif isa(b,'dynDate') && ~isempty(b)
|
||||
ts.freq = b.freq;
|
||||
ts.init = b;
|
||||
|
@ -354,7 +334,7 @@ ts.time = ts.init:(ts.init+ts.nobs);
|
|||
%$ t = zeros(7,1);
|
||||
%$
|
||||
%$ try
|
||||
%$ ts = dynSeries([transpose(1:5), transpose(6:10)],'1950Q1',{'Output'; 'Consumption'}, {'Y_t'; 'C_t'});
|
||||
%$ ts = dynSeries([transpose(1:5), transpose(6:10)],'1950q1',{'Output'; 'Consumption'}, {'Y_t'; 'C_t'});
|
||||
%$ t(1) = 1;
|
||||
%$ catch
|
||||
%$ t = 0;
|
||||
|
|
|
@ -1,6 +1,23 @@
|
|||
function A = extract(B,varargin)
|
||||
% Extract some variables from a database.
|
||||
|
||||
% Copyright (C) 2012, 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
A = dynSeries();
|
||||
|
||||
% Get the names of the variables to be extracted from dynSeries object B.
|
||||
|
@ -53,6 +70,7 @@ for i = 1:length(idVariableName)
|
|||
end
|
||||
|
||||
A.data = B.data(:,idVariableName);
|
||||
A.time = B.time;
|
||||
A.init = B.init;
|
||||
A.freq = B.freq;
|
||||
A.nobs = B.nobs;
|
||||
|
|
|
@ -58,11 +58,11 @@ function a = horzcat(varargin)
|
|||
|
||||
% Original author: stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if nargin==0 || nargin==1
|
||||
error('dynSeries::horzcat: I need at least two input arguments!')
|
||||
end
|
||||
|
||||
if nargin==2
|
||||
if nargin==0
|
||||
a = DynSeries();
|
||||
elseif nargin == 1
|
||||
a = varargin{1};
|
||||
elseif nargin==2
|
||||
a = horzcat2(varargin{1},varargin{2});
|
||||
else
|
||||
a = horzcat2(varargin{1},varargin{2});
|
||||
|
|
|
@ -39,8 +39,6 @@ function A = minus(B,C)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if ~isequal(B.vobs,C.vobs) && ~(isequal(B.vobs,1) || isequal(C.vobs,1))
|
||||
error(['dynSeries::plus: Cannot add ' inputname(1) ' and ' inputname(2) ' (wrong number of variables)!'])
|
||||
end
|
||||
|
@ -71,6 +69,7 @@ A = dynSeries();
|
|||
|
||||
A.freq = B.freq;
|
||||
A.init = B.init;
|
||||
A.time = B.time;
|
||||
A.nobs = max(B.nobs,C.nobs);
|
||||
A.vobs = max(B.vobs,C.vobs);
|
||||
A.name = repmat({'--NA--'},A.vobs,1);
|
||||
|
|
|
@ -39,8 +39,6 @@ function A = mrdivide(B,C)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if isa(B,'dynSeries') && isa(C,'dynSeries')
|
||||
% Element by element divisions of two dynSeries object
|
||||
if ~isequal(B.vobs,C.vobs) && ~(isequal(B.vobs,1) || isequal(C.vobs,1))
|
||||
|
@ -58,6 +56,7 @@ if isa(B,'dynSeries') && isa(C,'dynSeries')
|
|||
A = dynSeries();
|
||||
A.freq = B.freq;
|
||||
A.init = B.init;
|
||||
A.time = B.time;
|
||||
A.nobs = max(B.nobs,C.nobs);
|
||||
A.vobs = max(B.vobs,C.vobs);
|
||||
A.name = repmat({'--NA--'},A.vobs,1);
|
||||
|
@ -67,6 +66,7 @@ elseif isnumeric(C) && isreal(C) && isequal(length(C),1) && isa(B,'dynSeries')
|
|||
% division of a dynSeries object by a real scalar.
|
||||
A = dynSeries();
|
||||
A.freq = B.freq;
|
||||
A.time = B.time;
|
||||
A.init = B.init;
|
||||
A.nobs = B.nobs;
|
||||
A.vobs = B.vobs;
|
||||
|
@ -77,6 +77,7 @@ elseif isnumeric(B) && isreal(B) && isequal(length(B),1) && isa(C,'dynSeries')
|
|||
% division of a real scalar by a dynSeries object.
|
||||
A = dynSeries();
|
||||
A.freq = C.freq;
|
||||
A.time = C.time;
|
||||
A.init = C.init;
|
||||
A.nobs = C.nobs;
|
||||
A.vobs = C.vobs;
|
||||
|
|
|
@ -39,8 +39,6 @@ function A = mtimes(B,C)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if isa(B,'dynSeries') && isa(C,'dynSeries')
|
||||
% Element by element multiplication of two dynSeries object
|
||||
if ~isequal(B.vobs,C.vobs) && ~(isequal(B.vobs,1) || isequal(C.vobs,1))
|
||||
|
@ -58,6 +56,7 @@ if isa(B,'dynSeries') && isa(C,'dynSeries')
|
|||
A = dynSeries();
|
||||
A.freq = B.freq;
|
||||
A.init = B.init;
|
||||
A.time = B.time;
|
||||
A.nobs = max(B.nobs,C.nobs);
|
||||
A.vobs = max(B.vobs,C.vobs);
|
||||
A.name = repmat({'--NA--'},A.vobs,1);
|
||||
|
@ -68,6 +67,7 @@ elseif isnumeric(C) && isreal(C) && isequal(length(C),1) && isa(B,'dynSeries')
|
|||
A = dynSeries();
|
||||
A.freq = B.freq;
|
||||
A.init = B.init;
|
||||
A.time = B.time;
|
||||
A.nobs = B.nobs;
|
||||
A.vobs = B.vobs;
|
||||
A.name = repmat({'--NA--'},A.vobs,1);
|
||||
|
@ -78,6 +78,7 @@ elseif isnumeric(B) && isreal(B) && isequal(length(B),1) && isa(C,'dynSeries')
|
|||
A = dynSeries();
|
||||
A.freq = C.freq;
|
||||
A.init = C.init;
|
||||
A.time = C.time;
|
||||
A.nobs = C.nobs;
|
||||
A.vobs = C.vobs;
|
||||
A.name = repmat({'--NA--'},A.vobs,1);
|
||||
|
|
|
@ -1,2 +1,20 @@
|
|||
function n = numel(obj, varargin)
|
||||
n = 1;
|
||||
|
||||
% Copyright (C) 2012, 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
n = 1;
|
|
@ -108,5 +108,6 @@ else
|
|||
c.data = [c.data; NaN(b_last_date-c_last_date,c.vobs)];
|
||||
end
|
||||
a.data = [b.data, c.data];
|
||||
a.time = unique([b.time, c.time]);
|
||||
a.time = unique(b.time.append(c.time));
|
||||
end
|
||||
a.nobs = size(a.data,1);
|
|
@ -1,4 +1,4 @@
|
|||
function us = subsref(ts, S)
|
||||
function B = subsref(A, S)
|
||||
%@info:
|
||||
%! @deftypefn {Function File} {@var{us} =} subsref (@var{ts},S)
|
||||
%! @anchor{@dynSeries/subsref}
|
||||
|
@ -44,7 +44,7 @@ function us = subsref(ts, S)
|
|||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2011, 2012 Dynare Team
|
||||
% Copyright (C) 2011, 2012, 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -61,100 +61,88 @@ function us = subsref(ts, S)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
if length(S)==1 && isequal(S.type,'.')
|
||||
switch S.subs
|
||||
switch S(1).type
|
||||
case '.'
|
||||
switch S(1).subs
|
||||
case {'data','nobs','vobs','name','tex','freq','time','init'} % Public members.
|
||||
us = builtin('subsref', ts, S);
|
||||
B = builtin('subsref', A, S(1));
|
||||
case {'log','exp','ygrowth','qgrowth','ydiff','qdiff'} % Give "dot access" to public methods.
|
||||
us = feval(S.subs,ts);
|
||||
case {'save'}
|
||||
B = feval(S(1).subs,A);
|
||||
case {'save'} % Save dynSeries object on disk (default is a csv file).
|
||||
us = NaN;
|
||||
save(ts);
|
||||
if length(S)==2 && strcmp(S(2).type,'()')
|
||||
save(A,S(2).subs{:});
|
||||
S = shiftS(S);
|
||||
else
|
||||
save(A);
|
||||
end
|
||||
otherwise % Extract a sub-object by selecting one variable.
|
||||
ndx = strmatch(S.subs,ts.name);
|
||||
ndx = strmatch(S(1).subs,A.name,'exact');
|
||||
if ~isempty(ndx)
|
||||
us = dynSeries();
|
||||
us.data = ts.data(:,ndx);
|
||||
us.name = deblank(ts.name(ndx,:));
|
||||
us.tex = deblank(ts.tex(ndx,:));
|
||||
us.nobs = ts.nobs;
|
||||
us.vobs = 1;
|
||||
us.freq = ts.freq;
|
||||
us.init = ts.init;
|
||||
return
|
||||
B = dynSeries();
|
||||
B.data = A.data(:,ndx);
|
||||
B.name = deblank(A.name(ndx,:));
|
||||
B.tex = deblank(A.tex(ndx,:));
|
||||
B.nobs = A.nobs;
|
||||
B.vobs = 1;
|
||||
B.freq = A.freq;
|
||||
B.init = A.init;
|
||||
B.time = A.time;
|
||||
else
|
||||
error('dynSeries::subsref: Unknown public method, public member or variable!')
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if length(S)==1 && isequal(S.type,'()')
|
||||
if ischar(S.subs{1})
|
||||
us = dynSeries(S.subs{1});
|
||||
else
|
||||
% Extract a sub-object by selecting a sub-sample.
|
||||
if size(ts.data,2)>1
|
||||
S.subs = [S.subs, ':'];
|
||||
case '()'
|
||||
if ischar(S(1).subs{1})
|
||||
% If ts is an empty dynSeries object, populate this object by reading data in a file.
|
||||
if isempty(A)
|
||||
B = dynSeries(S(1).subs{1});
|
||||
else
|
||||
error(['dynSeries::subsref: dynSeries object ''' inputname(1) ''' is not empty!'])
|
||||
end
|
||||
elseif isa(S(1).subs{1},'dynDates')
|
||||
% Extract a subsample using a dynDates object
|
||||
[junk,tdx] = intersect(A.time.time,S(1).subs{1}.time,'rows');
|
||||
B = dynSeries();
|
||||
B.data = A.data(tdx,:);
|
||||
B.name = deblank(A.name);
|
||||
B.tex = deblank(A.tex);
|
||||
B.nobs = length(tdx);
|
||||
B.vobs = A.vobs;
|
||||
B.freq = A.freq;
|
||||
B.init = A.init+tdx(1);
|
||||
B.time = A.time(tdx,:);
|
||||
elseif isvector(S(1).subs{1}) && all(isint(S(1).subs{1}))
|
||||
% Extract a subsample using a vector of integers (observation index).
|
||||
if all(S(1).subs{1}>0) && all(S(1).subs{1}<=A.nobs)
|
||||
if size(A.data,2)>1
|
||||
S(1).subs = [S(1).subs, ':'];
|
||||
end
|
||||
B.data = builtin('subsref', A.data, S(1));
|
||||
B.nobs = size(B.data,1);
|
||||
B.vobs = A.vobs;
|
||||
B.freq = A.freq;
|
||||
B.time = builtin('subsref', A.time, S(1));
|
||||
B.init = A.init+S(1).subs{1}(1);
|
||||
B.name = A.name;
|
||||
B.tex = A.tex;
|
||||
else
|
||||
error('dynSeries::subsref: Indices are out of bounds!')
|
||||
end
|
||||
us.data = builtin('subsref', ts.data, S);
|
||||
us.nobs = size(us.data,1);
|
||||
us.vobs = ts.vobs;
|
||||
us.freq = ts.freq;
|
||||
us.time = builtin('subsref', ts.time, S);
|
||||
us.init = ts.init+S.subs{1}(1);
|
||||
us.name = ts.name;
|
||||
us.tex = ts.tex;
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if (length(S)==2) && (isequal(S(1).subs,'init'))
|
||||
if isequal(S(2).type,'.') && ( isequal(S(2).subs,'freq') || isequal(S(2).subs,'time') )
|
||||
us = builtin('subsref', ts.init, S(2));
|
||||
else
|
||||
error('dynSeries:subsref:: I don''t understand what you are trying to do!')
|
||||
error('dynSeries::subsref: I have no idea of what you are trying to do!')
|
||||
end
|
||||
return
|
||||
case '{}'
|
||||
B = extract(A,S(1).subs{:});
|
||||
otherwise
|
||||
error('dynSeries::subsref: What the Hell are you doin'' here?!')
|
||||
end
|
||||
|
||||
if (length(S)==2) && (isequal(S(1).type,'.')) && (isequal(S(1).subs,'data')) && (isequal(S(2).type,'()'))
|
||||
us = builtin('subsref',ts.data,S(2));
|
||||
return
|
||||
S = shiftS(S);
|
||||
if ~isempty(S)
|
||||
B = subsref(B, S);
|
||||
end
|
||||
|
||||
if (length(S)==1) && isequal(S(1).type,'{}')
|
||||
us = extract(ts,S(1).subs{:});
|
||||
return
|
||||
end
|
||||
|
||||
if (length(S)==2) && isequal(S(1).type,'{}')
|
||||
us = extract(ts,S(1).subs{:});
|
||||
us = subsref(us, S(2));
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if (length(S)==2) && isequal(S(1).subs,'save') && isequal(S(1).type,'.') && isequal(S(2).type,'()')
|
||||
us = NaN;
|
||||
save(ts,S(2).subs{:});
|
||||
return
|
||||
end
|
||||
|
||||
if (length(S)==2) && isequal(S(1).subs,'set_names') && isequal(S(1).type,'.') && isequal(S(2).type,'()')
|
||||
us = set_names(ts,S(2).subs{:});
|
||||
return
|
||||
end
|
||||
|
||||
if (length(S)==2) && isequal(S(1).subs,'name') && isequal(S(1).type,'.') && isequal(S(2).type,'{}')
|
||||
us = ts.name{S(2).subs{1}};
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
|
||||
%@test:1
|
||||
%$ % Define a data set.
|
||||
%$ A = [transpose(1:10),2*transpose(1:10)];
|
||||
|
@ -376,3 +364,34 @@ end
|
|||
%$
|
||||
%$ T = all(t);
|
||||
%@eof:8
|
||||
|
||||
%@test:9
|
||||
%$ % Define a data set.
|
||||
%$ A = [transpose(1:60),2*transpose(1:60),3*transpose(1:60)];
|
||||
%$
|
||||
%$ % Define names
|
||||
%$ A_name = {'A1';'A2';'B1'};
|
||||
%$
|
||||
%$ % Instantiate a time series object.
|
||||
%$ ts1 = dynSeries(A,'1971Q1',A_name,[]);
|
||||
%$
|
||||
%$ % Define the range of a subsample.
|
||||
%$ range = dynDate('1971Q2'):dynDate('1971Q4');
|
||||
%$ % Call the tested method.
|
||||
%$ a = ts1(range);
|
||||
%$
|
||||
%$ % Expected results.
|
||||
%$ e.data = A(2:4,:);
|
||||
%$ e.nobs = 3;
|
||||
%$ e.vobs = 3;
|
||||
%$ e.name = {'A1';'A2';'B1'};
|
||||
%$ e.freq = 4;
|
||||
%$ e.init = dynDate('1971Q2');
|
||||
%$
|
||||
%$ t(1) = dyn_assert(e.data,a.data);
|
||||
%$ t(2) = dyn_assert(e.nobs,a.nobs);
|
||||
%$ t(3) = dyn_assert(e.vobs,a.vobs);
|
||||
%$ t(4) = dyn_assert(e.name,a.name);
|
||||
%$ t(5) = dyn_assert(e.init,a.init);
|
||||
%$ T = all(t);
|
||||
%@eof:9
|
||||
|
|
|
@ -39,14 +39,13 @@ function A = uminus(B)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
A = dynSeries();
|
||||
|
||||
A.freq = B.freq;
|
||||
A.nobs = B.nobs;
|
||||
A.vobs = B.vobs;
|
||||
A.init = B.init;
|
||||
A.time = B.time;
|
||||
A.name = repmat({'--NA--'},A.vobs,1);
|
||||
A.data = -(B.data);
|
||||
|
||||
|
|
|
@ -123,6 +123,17 @@ t = 0;
|
|||
hh = dyn_waitbar(0,'Please wait. Extended Path simulations...');
|
||||
set(hh,'Name','EP simulations.');
|
||||
|
||||
% hybrid correction
|
||||
pfm.hybrid_order = options_.ep.stochastic.hybrid_order;
|
||||
if pfm.hybrid_order
|
||||
oo_.dr = set_state_space(oo_.dr,M_,options_);
|
||||
options = options_;
|
||||
options.order = pfm.hybrid_order;
|
||||
pfm.dr = resol(0,M_,options,oo_);
|
||||
else
|
||||
pfm.dr = [];
|
||||
end
|
||||
|
||||
% Main loop.
|
||||
while (t<sample_size)
|
||||
if ~mod(t,10)
|
||||
|
@ -164,7 +175,14 @@ while (t<sample_size)
|
|||
if options_.ep.stochastic.order == 0
|
||||
[flag,tmp,err] = solve_perfect_foresight_model(endo_simul_1,exo_simul_1,pfm1);
|
||||
else
|
||||
[flag,tmp] = solve_stochastic_perfect_foresight_model(endo_simul_1,exo_simul_1,pfm1,options_.ep.stochastic.quadrature.nodes,options_.ep.stochastic.order);
|
||||
switch(options_.ep.stochastic.algo)
|
||||
case 0
|
||||
[flag,tmp] = ...
|
||||
solve_stochastic_perfect_foresight_model(endo_simul_1,exo_simul_1,pfm1,options_.ep.stochastic.quadrature.nodes,options_.ep.stochastic.order);
|
||||
case 1
|
||||
[flag,tmp] = ...
|
||||
solve_stochastic_perfect_foresight_model_1(endo_simul_1,exo_simul_1,pfm1,options_.ep.stochastic.quadrature.nodes,options_.ep.stochastic.order);
|
||||
end
|
||||
end
|
||||
end
|
||||
info_convergence = ~flag;
|
||||
|
|
|
@ -0,0 +1,285 @@
|
|||
function [flag,endo_simul,err] = solve_stochastic_perfect_foresight_model_1(endo_simul,exo_simul,pfm,nnodes,order)
|
||||
|
||||
% Copyright (C) 2012 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
flag = 0;
|
||||
err = 0;
|
||||
stop = 0;
|
||||
|
||||
params = pfm.params;
|
||||
steady_state = pfm.steady_state;
|
||||
ny = pfm.ny;
|
||||
periods = pfm.periods;
|
||||
dynamic_model = pfm.dynamic_model;
|
||||
lead_lag_incidence = pfm.lead_lag_incidence;
|
||||
nyp = pfm.nyp;
|
||||
nyf = pfm.nyf;
|
||||
i_cols_1 = pfm.i_cols_1;
|
||||
i_cols_A1 = pfm.i_cols_A1;
|
||||
i_cols_j = pfm.i_cols_j;
|
||||
i_cols_T = nonzeros(lead_lag_incidence(1:2,:)');
|
||||
hybrid_order = pfm.hybrid_order;
|
||||
dr = pfm.dr;
|
||||
|
||||
maxit = pfm.maxit_;
|
||||
tolerance = pfm.tolerance;
|
||||
verbose = pfm.verbose;
|
||||
|
||||
number_of_shocks = size(exo_simul,2);
|
||||
|
||||
[nodes,weights] = gauss_hermite_weights_and_nodes(nnodes);
|
||||
|
||||
% make sure that there is a node equal to zero
|
||||
% and permute nodes and weights to have zero first
|
||||
k = find(abs(nodes) < 1e-12);
|
||||
if ~isempty(k)
|
||||
nodes = [nodes(k); nodes(1:k-1); nodes(k+1:end)];
|
||||
weights = [weights(k); weights(1:k-1); weights(k+1:end)];
|
||||
else
|
||||
error('there is no nodes equal to zero')
|
||||
end
|
||||
|
||||
if number_of_shocks>1
|
||||
nodes = repmat(nodes,1,number_of_shocks)*chol(pfm.Sigma);
|
||||
% to be fixed for Sigma ~= I
|
||||
for i=1:number_of_shocks
|
||||
rr(i) = {nodes(:,i)};
|
||||
ww(i) = {weights};
|
||||
end
|
||||
nodes = cartesian_product_of_sets(rr{:});
|
||||
weights = prod(cartesian_product_of_sets(ww{:}),2);
|
||||
nnodes = nnodes^number_of_shocks;
|
||||
else
|
||||
nodes = nodes*sqrt(pfm.Sigma);
|
||||
end
|
||||
|
||||
if hybrid_order > 0
|
||||
if hybrid_order == 2
|
||||
h_correction = 0.5*dr.ghs2(dr.inv_order_var);
|
||||
end
|
||||
end
|
||||
|
||||
if verbose
|
||||
disp ([' -----------------------------------------------------']);
|
||||
disp (['MODEL SIMULATION :']);
|
||||
fprintf('\n');
|
||||
end
|
||||
|
||||
z = endo_simul(find(lead_lag_incidence'));
|
||||
[d1,jacobian] = dynamic_model(z,exo_simul,params,steady_state,2);
|
||||
|
||||
% Each column of Y represents a different world
|
||||
% The upper right cells are unused
|
||||
% The first row block is ny x 1
|
||||
% The second row block is ny x nnodes
|
||||
% The third row block is ny x nnodes^2
|
||||
% and so on until size ny x nnodes^order
|
||||
world_nbr = 1+(nnodes-1)*order;
|
||||
Y = repmat(endo_simul(:),1,world_nbr);
|
||||
|
||||
% The columns of A map the elements of Y such that
|
||||
% each block of Y with ny rows are unfolded column wise
|
||||
dimension = ny*(order+(nnodes-1)*(order-1)*order/2+(periods-order)*world_nbr);
|
||||
if order == 0
|
||||
i_upd_r = (1:ny*periods);
|
||||
i_upd_y = i_upd_r + ny;
|
||||
else
|
||||
i_upd_r = zeros(dimension,1);
|
||||
i_upd_y = i_upd_r;
|
||||
i_upd_r(1:ny) = (1:ny);
|
||||
i_upd_y(1:ny) = ny+(1:ny);
|
||||
i1 = ny+1;
|
||||
i2 = 2*ny;
|
||||
n1 = ny+1;
|
||||
n2 = 2*ny;
|
||||
for i=2:periods
|
||||
k = n1:n2;
|
||||
for j=1:(1+(nnodes-1)*min(i-1,order))
|
||||
i_upd_r(i1:i2) = (n1:n2)+(j-1)*ny*periods;
|
||||
i_upd_y(i1:i2) = (n1:n2)+ny+(j-1)*ny*(periods+2);
|
||||
i1 = i2+1;
|
||||
i2 = i2+ny;
|
||||
end
|
||||
n1 = n2+1;
|
||||
n2 = n2+ny;
|
||||
end
|
||||
end
|
||||
icA = [find(lead_lag_incidence(1,:)) find(lead_lag_incidence(2,:))+world_nbr*ny ...
|
||||
find(lead_lag_incidence(3,:))+2*world_nbr*ny]';
|
||||
h1 = clock;
|
||||
for iter = 1:maxit
|
||||
h2 = clock;
|
||||
A1 = sparse([],[],[],ny*(order+(nnodes-1)*(order-1)*order/2),dimension,(order+1)*world_nbr*nnz(jacobian));
|
||||
res = zeros(ny,periods,world_nbr);
|
||||
i_rows = 1:ny;
|
||||
i_cols = find(lead_lag_incidence');
|
||||
i_cols_p = i_cols(1:nyp);
|
||||
i_cols_s = i_cols(nyp+(1:ny));
|
||||
i_cols_f = i_cols(nyp+ny+(1:nyf));
|
||||
i_cols_A = i_cols;
|
||||
i_cols_Ap0 = i_cols_p;
|
||||
i_cols_As = i_cols_s;
|
||||
i_cols_Af0 = i_cols_f - ny;
|
||||
i_hc = i_cols_f - 2*ny;
|
||||
for i = 1:order+1
|
||||
i_w_p = 1;
|
||||
for j = 1:(1+(nnodes-1)*(i-1))
|
||||
innovation = exo_simul;
|
||||
if i <= order && j == 1
|
||||
% first world, integrating future shocks
|
||||
for k=1:nnodes
|
||||
if i == 2
|
||||
i_cols_Ap = i_cols_Ap0;
|
||||
elseif i > 2
|
||||
i_cols_Ap = i_cols_Ap0 + ny*(i-2+(nnodes- ...
|
||||
1)*(i-2)*(i-3)/2);
|
||||
end
|
||||
if k == 1
|
||||
i_cols_Af = i_cols_Af0 + ny*(i-1+(nnodes-1)*i*(i-1)/ ...
|
||||
2);
|
||||
else
|
||||
i_cols_Af = i_cols_Af0 + ny*(i-1+(nnodes-1)*i*(i-1)/ ...
|
||||
2+(i-1)*(nnodes-1) ...
|
||||
+ k - 1);
|
||||
end
|
||||
if i > 1
|
||||
innovation(i+1,:) = nodes(k,:);
|
||||
end
|
||||
if k == 1
|
||||
k1 = 1;
|
||||
else
|
||||
k1 = (nnodes-1)*(i-1)+k;
|
||||
end
|
||||
if hybrid_order == 2 && (k > 1 || i == order)
|
||||
y = [Y(i_cols_p,1);
|
||||
Y(i_cols_s,1);
|
||||
Y(i_cols_f,k1)+h_correction(i_hc)];
|
||||
else
|
||||
y = [Y(i_cols_p,1);
|
||||
Y(i_cols_s,1);
|
||||
Y(i_cols_f,k1)];
|
||||
end
|
||||
[d1,jacobian] = dynamic_model(y,innovation,params,steady_state,i+1);
|
||||
if i == 1
|
||||
% in first period we don't keep track of
|
||||
% predetermined variables
|
||||
i_cols_A = [i_cols_As - ny; i_cols_Af];
|
||||
A1(i_rows,i_cols_A) = A1(i_rows,i_cols_A) + weights(k)*jacobian(:,i_cols_1);
|
||||
else
|
||||
i_cols_A = [i_cols_Ap; i_cols_As; i_cols_Af];
|
||||
A1(i_rows,i_cols_A) = A1(i_rows,i_cols_A) + weights(k)*jacobian(:,i_cols_j);
|
||||
end
|
||||
res(:,i,1) = res(:,i,1)+weights(k)*d1;
|
||||
end
|
||||
elseif j > 1 + (nnodes-1)*(i-2)
|
||||
% new world, using previous state of world 1 and hit
|
||||
% by shocks from nodes
|
||||
i_cols_Ap = i_cols_Ap0 + ny*(i-2+(nnodes-1)*(i-2)*(i-3)/2);
|
||||
i_cols_Af = i_cols_Af0 + ny*(i+(nnodes-1)*i*(i-1)/2+j-2);
|
||||
k = j - (nnodes-1)*(i-2);
|
||||
innovation(i+1,:) = nodes(k,:);
|
||||
y = [Y(i_cols_p,1);
|
||||
Y(i_cols_s,j);
|
||||
Y(i_cols_f,j)];
|
||||
[d1,jacobian] = dynamic_model(y,innovation,params,steady_state,i+1);
|
||||
i_cols_A = [i_cols_Ap; i_cols_As; i_cols_Af];
|
||||
A1(i_rows,i_cols_A) = jacobian(:,i_cols_j);
|
||||
res(:,i,j) = d1;
|
||||
i_cols_Af = i_cols_Af + ny;
|
||||
else
|
||||
% existing worlds other than 1
|
||||
i_cols_Ap = i_cols_Ap0 + ny*(i-2+(nnodes-1)*(i-2)*(i-3)/2+j-1);
|
||||
i_cols_Af = i_cols_Af0 + ny*(i+(nnodes-1)*i*(i-1)/2+j-2);
|
||||
y = [Y(i_cols_p,j);
|
||||
Y(i_cols_s,j);
|
||||
Y(i_cols_f,j)];
|
||||
[d1,jacobian] = dynamic_model(y,innovation,params,steady_state,i+1);
|
||||
i_cols_A = [i_cols_Ap; i_cols_As; i_cols_Af];
|
||||
A1(i_rows,i_cols_A) = jacobian(:,i_cols_j);
|
||||
res(:,i,j) = d1;
|
||||
i_cols_Af = i_cols_Af + ny;
|
||||
end
|
||||
i_rows = i_rows + ny;
|
||||
if mod(j,nnodes) == 0
|
||||
i_w_p = i_w_p + 1;
|
||||
end
|
||||
if i > 1
|
||||
i_cols_As = i_cols_As + ny;
|
||||
end
|
||||
end
|
||||
i_cols_p = i_cols_p + ny;
|
||||
i_cols_s = i_cols_s + ny;
|
||||
i_cols_f = i_cols_f + ny;
|
||||
end
|
||||
nzA = cell(periods,world_nbr);
|
||||
parfor j=1:world_nbr
|
||||
i_rows_y = find(lead_lag_incidence')+(order+1)*ny;
|
||||
offset_c = ny*(order+(nnodes-1)*(order-1)*order/2+j-1);
|
||||
offset_r = (j-1)*ny;
|
||||
for i=order+2:periods
|
||||
[d1,jacobian] = dynamic_model(Y(i_rows_y,j), ...
|
||||
exo_simul,params, ...
|
||||
steady_state,i+1);
|
||||
if i == periods
|
||||
[ir,ic,v] = find(jacobian(:,i_cols_T));
|
||||
else
|
||||
[ir,ic,v] = find(jacobian(:,i_cols_j));
|
||||
end
|
||||
nzA{i,j} = [offset_r+ir,offset_c+icA(ic), v]';
|
||||
res(:,i,j) = d1;
|
||||
i_rows_y = i_rows_y + ny;
|
||||
offset_c = offset_c + world_nbr*ny;
|
||||
offset_r = offset_r + world_nbr*ny;
|
||||
end
|
||||
end
|
||||
err = max(abs(res(i_upd_r)));
|
||||
if err < tolerance
|
||||
stop = 1;
|
||||
if verbose
|
||||
fprintf('\n') ;
|
||||
disp([' Total time of simulation :' num2str(etime(clock,h1))]) ;
|
||||
fprintf('\n') ;
|
||||
disp([' Convergency obtained.']) ;
|
||||
fprintf('\n') ;
|
||||
end
|
||||
flag = 0;% Convergency obtained.
|
||||
endo_simul = reshape(Y(:,1),ny,periods+2);%Y(ny+(1:ny),1);
|
||||
% figure;plot(Y(16:ny:(periods+2)*ny,:))
|
||||
% pause
|
||||
break
|
||||
end
|
||||
A2 = [nzA{:}]';
|
||||
A = [A1; sparse(A2(:,1),A2(:,2),A2(:,3),ny*(periods-order-1)*world_nbr,dimension)];
|
||||
dy = -A\res(i_upd_r);
|
||||
Y(i_upd_y) = Y(i_upd_y) + dy;
|
||||
end
|
||||
|
||||
if ~stop
|
||||
if verbose
|
||||
fprintf('\n') ;
|
||||
disp([' Total time of simulation :' num2str(etime(clock,h1))]) ;
|
||||
fprintf('\n') ;
|
||||
disp(['WARNING : maximum number of iterations is reached (modify options_.maxit_).']) ;
|
||||
fprintf('\n') ;
|
||||
end
|
||||
flag = 1;% more iterations are needed.
|
||||
endo_simul = 1;
|
||||
end
|
||||
if verbose
|
||||
disp (['-----------------------------------------------------']) ;
|
||||
end
|
|
@ -177,12 +177,14 @@ ep.set_dynare_seed_to_default = 1;
|
|||
ep.stack_solve_algo = 4;
|
||||
% Stochastic extended path related options.
|
||||
ep.stochastic.method = '';
|
||||
ep.stochastic.algo = 0;
|
||||
ep.stochastic.quadrature.ortpol = 'hermite';
|
||||
ep.stochastic.order = 0;
|
||||
ep.stochastic.quadrature.nodes = 5;
|
||||
ep.stochastic.quadrature.pruned.status = 0;
|
||||
ep.stochastic.quadrature.pruned.relative = 1e-5;
|
||||
ep.stochastic.quadrature.pruned.level = 1e-5;
|
||||
ep.stochastic.hybrid_order = 0;
|
||||
% Copy ep structure in options_ global structure
|
||||
options_.ep = ep;
|
||||
|
||||
|
@ -345,6 +347,7 @@ options_.filter_step_ahead = [];
|
|||
options_.filtered_vars = 0;
|
||||
options_.first_obs = 1;
|
||||
options_.kalman_algo = 0;
|
||||
options_.fast_kalman = 0;
|
||||
options_.kalman_tol = 1e-10;
|
||||
options_.use_univariate_filters_if_singularity_is_detected = 1;
|
||||
options_.riccati_tol = 1e-6;
|
||||
|
|
|
@ -3,10 +3,10 @@ function o = createGraph(o)
|
|||
% Create the graph
|
||||
%
|
||||
% INPUTS
|
||||
% o - Graph Object
|
||||
% o [graph] graph object
|
||||
%
|
||||
% OUTPUTS
|
||||
% o - Graph Object
|
||||
% o [graph] graph object
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
@ -51,29 +51,34 @@ end
|
|||
%set(h, 'units', 'normalized', 'outerposition', [0 0 1 1]);
|
||||
|
||||
if strcmpi(o.seriestouse, 'all')
|
||||
data = o.data.data;
|
||||
ds = o.data;
|
||||
else
|
||||
data = o.data{o.seriestouse{:}}.data;
|
||||
ds = o.data{o.seriestouse{:}};
|
||||
end
|
||||
|
||||
x=[1:1:o.data.nobs];
|
||||
xlabels=getDatesCellStringArray(o.data.time);
|
||||
if ~strcmp(o.xrange, 'all')
|
||||
dd1 = dynDate(o.xrange{1});
|
||||
dd2 = dynDate(o.xrange{2});
|
||||
ds = ds(dd1:dd2);
|
||||
end
|
||||
data = ds.data;
|
||||
|
||||
x = 1:1:ds.nobs;
|
||||
xlabels = getDatesCellStringArray(ds.time);
|
||||
|
||||
plot(x, data);
|
||||
|
||||
if ~isempty(o.shade)
|
||||
x1 = strmatch(lower(o.shade{1}), xlabels, 'exact');
|
||||
x2 = strmatch(lower(o.shade{2}), xlabels, 'exact');
|
||||
yrange = get(gca, 'YLim');
|
||||
if ~strcmp(o.yrange, 'all')
|
||||
ylim([o.yrange{:}]);
|
||||
end
|
||||
|
||||
if isempty(x1)
|
||||
error(['@graph.createGraph: ' o.shade{1} ' not in date range of ' ...
|
||||
'provided data']);
|
||||
end
|
||||
if isempty(x2)
|
||||
error(['@graph.createGraph: ' o.shade{2} ' not in date range of ' ...
|
||||
'provided data']);
|
||||
end
|
||||
if ~isempty(o.shade)
|
||||
x1 = find(strcmp(o.shade{1}, xlabels));
|
||||
x2 = find(strcmp(o.shade{2}, xlabels));
|
||||
assert(~isempty(x1) && ~isempty(x2), ['@graph.createGraph: either ' ...
|
||||
o.shade{1} ' or ' o.shade{2} 'is not in the date ' ...
|
||||
'range of data selected.']);
|
||||
yrange = get(gca, 'YLim');
|
||||
|
||||
% From ShadePlotForEmpahsis (Matlab Exchange)
|
||||
% use patch bc area doesn't work with matlab2tikz
|
||||
|
@ -85,11 +90,7 @@ set(gca,'XTick', x);
|
|||
set(gca,'XTickLabel', xlabels);
|
||||
|
||||
if o.legend
|
||||
if strcmpi(o.seriestouse, 'all')
|
||||
lh = legend(o.data.name);
|
||||
else
|
||||
lh = legend(o.seriestouse{:});
|
||||
end
|
||||
lh = legend(ds.name);
|
||||
set(lh, 'orientation', o.legend_orientation);
|
||||
set(lh, 'Location', o.legend_location);
|
||||
set(lh, 'FontSize', o.legend_font_size);
|
||||
|
@ -109,7 +110,7 @@ if ~isempty(o.title)
|
|||
end
|
||||
drawnow;
|
||||
|
||||
o.figname = ['figure-' num2str(cputime) '.tex'];
|
||||
o.figname = [tempname '.tex'];
|
||||
disp(' converting to tex....');
|
||||
matlab2tikz('filename', o.figname, ...
|
||||
'showInfo', false, ...
|
||||
|
|
|
@ -3,7 +3,7 @@ function display(o)
|
|||
% Display a Graph object
|
||||
%
|
||||
% INPUTS
|
||||
% none
|
||||
% o [graph] graph object
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
|
|
|
@ -3,11 +3,13 @@ function o = graph(varargin)
|
|||
% Graph Class Constructor
|
||||
%
|
||||
% INPUTS
|
||||
% 0 args => empty graph
|
||||
% 1 arg (graph class) => copy object
|
||||
% varargin 0 args : empty graph object
|
||||
% 1 arg : must be graph object (return a copy of arg)
|
||||
% > 1 args: option/value pairs (see structure below for
|
||||
% options)
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
% o [graph] graph object
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
@ -42,7 +44,9 @@ o.footnote = '';
|
|||
o.figname = '';
|
||||
o.data = '';
|
||||
o.seriestouse = 'all';
|
||||
o.shade = ''; %{1959q1:1964q4}
|
||||
o.shade = '';
|
||||
o.xrange = 'all';
|
||||
o.yrange = 'all';
|
||||
|
||||
o.grid = true;
|
||||
|
||||
|
|
|
@ -3,10 +3,11 @@ function o = write(o, fid)
|
|||
% Write a Graph object
|
||||
%
|
||||
% INPUTS
|
||||
% fid - int, file id
|
||||
% o [graph] graph object
|
||||
% fid [integer] file id
|
||||
%
|
||||
% OUTPUTS
|
||||
% o - this
|
||||
% o [graph] graph object
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
|
|
@ -19,10 +19,4 @@ function ps = addPage(ps, varargin)
|
|||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
ps.objArray = ps.objArray.addObj(page(varargin{:}));
|
||||
%assert(nargin >= 1 && nargin <= 3)
|
||||
%if nargin == 1
|
||||
% ps.objArray = ps.objArray.addObj(page());
|
||||
%else
|
||||
% ps.objArray = ps.objArray.addObj(varargin{:});
|
||||
%end
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
function o = addGraph(o, varargin)
|
||||
%function o = addGraph(o, varargin)
|
||||
% Add a graph to the current section of the current page in the report
|
||||
%
|
||||
% INPUTS
|
||||
% o [report] report object
|
||||
% varargin arguments to @section/addGraph.m
|
||||
%
|
||||
% OUTPUTS
|
||||
% o [report] updated report object
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
lastPage = o.pages.numPages();
|
||||
lastSection = o.pages(lastPage).numSections();
|
||||
o.pages(lastPage).sections(lastSection) = ...
|
||||
o.pages(lastPage).sections(lastSection).addGraph(varargin{:});
|
||||
end
|
|
@ -1,14 +1,13 @@
|
|||
function o = addPage(o, varargin)
|
||||
%function o = addPage(o, varargin)
|
||||
% Add a page to the Cell Array of pages in the report
|
||||
% Add a page to the report
|
||||
%
|
||||
% INPUTS
|
||||
% 1 args => add empty page
|
||||
% 2 args => add given page
|
||||
% 3 args => add page at index
|
||||
% o [report] report object
|
||||
% varargin arguments to @section/addGraph.m
|
||||
%
|
||||
% OUTPUTS
|
||||
% updated report object
|
||||
% o [report] updated report object
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
@ -30,22 +29,6 @@ function o = addPage(o, varargin)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
%assert(nargin >= 1 && nargin <= 3, ['incorrect number of arguments passed ' ...
|
||||
% 'to addPage']);
|
||||
%assert(isa(r, 'report'), 'First argument must be a report object');
|
||||
%if nargin > 1
|
||||
% assert(isa(varargin{1},'page'), ['Optional 2nd arg to addPage must be a ' ...
|
||||
% 'Page']);
|
||||
% if nargin > 2
|
||||
% assert(isnumeric(varargin{2}), ['Optional 3rd arg to addPage must be ' ...
|
||||
% 'an index']);
|
||||
% end
|
||||
%end
|
||||
|
||||
if nargin == 1
|
||||
o.pages = o.pages.addPage('orientation', o.orientation, 'paper', o.paper);
|
||||
else
|
||||
o.pages = o.pages.addPage('orientation', o.orientation, 'paper', ...
|
||||
o.paper, varargin{:});
|
||||
end
|
||||
o.pages = o.pages.addPage('orientation', o.orientation, 'paper', o.paper, ...
|
||||
varargin{:});
|
||||
end
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
function b = isint(a)
|
||||
% Copyright (C) 2012 Dynare Team
|
||||
function o = addSection(o, varargin)
|
||||
%function o = addSection(o, varargin)
|
||||
% Add a section to the current page in the report
|
||||
%
|
||||
% INPUTS
|
||||
% o [report] report object
|
||||
% varargin arguments to @section/addGraph.m
|
||||
%
|
||||
% OUTPUTS
|
||||
% o [report] updated report object
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -16,6 +29,6 @@ function b = isint(a)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
|
||||
|
||||
b = (floor(a)==a);
|
||||
o.pages(o.pages.numPages()) = ...
|
||||
o.pages(o.pages.numPages()).addSection(varargin{:});
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
function o = addTable(o, varargin)
|
||||
%function o = addTable(o, varargin)
|
||||
% Add a table to the current section of the current page in the report
|
||||
%
|
||||
% INPUTS
|
||||
% o [report] report object
|
||||
% varargin arguments to @section/addTable.m
|
||||
%
|
||||
% OUTPUTS
|
||||
% o [report] updated report object
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2013 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
lastPage = o.pages.numPages();
|
||||
lastSection = o.pages(lastPage).numSections();
|
||||
o.pages(lastPage).sections(lastSection) = ...
|
||||
o.pages(lastPage).sections(lastSection).addTable(varargin{:});
|
||||
end
|
|
@ -3,7 +3,7 @@ function display(o)
|
|||
% Display a Report object
|
||||
%
|
||||
% INPUTS
|
||||
% none
|
||||
% o [report] report object
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
function np = numPages(r)
|
||||
%function np = numPages(r)
|
||||
function n = numPages(o)
|
||||
%function n = numPages(o)
|
||||
% return the number of pages currently in the report
|
||||
%
|
||||
% INPUTS
|
||||
% none
|
||||
% o [report] report object
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
% n [integer] number of pages in the report object
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
@ -28,5 +28,5 @@ function np = numPages(r)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
np = r.pages.numPages();
|
||||
n = o.pages.numPages();
|
||||
end
|
|
@ -3,10 +3,10 @@ function validateOrientation(orientation)
|
|||
% Validate orientation string
|
||||
%
|
||||
% INPUTS
|
||||
% char : the orientation
|
||||
% orientation [char] orientation (one of 'portrait' or 'landscape')
|
||||
%
|
||||
% OUTPUTS
|
||||
% char : lowercase orientation
|
||||
% none
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
@ -29,5 +29,6 @@ function validateOrientation(orientation)
|
|||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
assert(any(strcmpi(orientation, {'portrait', 'landscape'})), ['Valid ' ...
|
||||
'orientation arguments are: ''portrait'' and ''landscape''.']);
|
||||
'orientation arguments are: ''portrait'' and ' ...
|
||||
'''landscape''.']);
|
||||
end
|
|
@ -3,10 +3,10 @@ function validatePaper(paper)
|
|||
% Validate paper string
|
||||
%
|
||||
% INPUTS
|
||||
% char : paper size
|
||||
% paper [char] valid LaTeX paper type
|
||||
%
|
||||
% OUTPUTS
|
||||
% char : lowercase paper
|
||||
% none
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
|
|
@ -3,11 +3,12 @@ function o = report(varargin)
|
|||
% Report Class Constructor
|
||||
%
|
||||
% INPUTS
|
||||
% 1 report class object => make a copy
|
||||
% Otherwise, option/value pairs (see structure below for options)
|
||||
% varargin 0 args : empty report object
|
||||
% 1 arg : must be report object (return a copy of arg)
|
||||
% > 1 args: option/value pairs (see structure below for options)
|
||||
%
|
||||
% OUTPUTS
|
||||
% none
|
||||
% o [report] report object
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
|
|
@ -3,10 +3,10 @@ function o = write(o)
|
|||
% Write Report object
|
||||
%
|
||||
% INPUTS
|
||||
% o - Report Object
|
||||
% o [report] report object
|
||||
%
|
||||
% OUTPUTS
|
||||
% o - Report Object
|
||||
% o [report] report object
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
|
|
@ -39,9 +39,8 @@ o.hlines = false;
|
|||
o.vlines = false;
|
||||
|
||||
o.data = '';
|
||||
o.datatitles = '';
|
||||
o.seriestouse = 'all';
|
||||
o.range = '';
|
||||
o.seriestouse = '';
|
||||
o.range = {};
|
||||
o.precision = 1;
|
||||
|
||||
if nargin == 1
|
||||
|
@ -69,6 +68,42 @@ elseif nargin > 1
|
|||
end
|
||||
end
|
||||
|
||||
% Check options provided by user
|
||||
assert(ischar(o.title), '@table.table: title must be a string');
|
||||
assert(ischar(o.footnote), '@table.table: footnote must be a string');
|
||||
assert(ischar(o.config), '@table.table: config file must be a string');
|
||||
assert(islogical(o.hlines), '@table.table: hlines must be true or false');
|
||||
assert(islogical(o.vlines), '@table.table: vlines must be true or false');
|
||||
assert(isint(o.precision), '@table.table: precision must be an int');
|
||||
assert(isempty(o.range) || (iscell(o.range) && length(o.range) == 2 && ...
|
||||
ischar(o.range{1}) && ischar(o.range{2})), ...
|
||||
['@table.table: range is specified as ''{''1999q1'',''999q2''}''.']);
|
||||
|
||||
assert(~isempty(o.data), '@table.table: must provide data');
|
||||
msg = ['@table.table: data must either be a dynSeries or a cell array of ' ...
|
||||
'dynSeries'];
|
||||
if length(o.data) == 1
|
||||
assert(isa(o.data, 'dynSeries'), msg);
|
||||
else
|
||||
assert(iscell(o.data), msg);
|
||||
for i=1:length(o.data)
|
||||
assert(isa(o.data{i}, 'dynSeries'), msg);
|
||||
end
|
||||
end
|
||||
|
||||
msg = ['@table.table: series to use must either be a string or a cell array ' ...
|
||||
'of strings'];
|
||||
if ~isempty(o.seriestouse)
|
||||
if length(o.seriestouse) == 1
|
||||
assert(ischar(o.seriestouse), msg);
|
||||
else
|
||||
assert(iscell(o.seriestouse), msg);
|
||||
for i=1:length(o.seriestouse)
|
||||
assert(ischar(o.seriestouse{i}), msg);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
% Create table object
|
||||
o = class(o, 'table');
|
||||
end
|
|
@ -34,6 +34,12 @@ if isempty(o.data)
|
|||
return
|
||||
end
|
||||
|
||||
if isempty(o.seriestouse)
|
||||
ds = o.data;
|
||||
else
|
||||
ds = o.data{o.seriestouse{:}};
|
||||
end
|
||||
|
||||
%number of left-hand columns, 1 until we allow the user to group data,
|
||||
% e.g.: GDP Europe
|
||||
% GDP France
|
||||
|
@ -45,7 +51,7 @@ disp('creating table.........');
|
|||
fprintf(fid, '%% Table Object\n');
|
||||
fprintf(fid, '\\begin{tabular}{l');
|
||||
|
||||
dates = o.data.time;
|
||||
dates = ds.time;
|
||||
ndates = dates.ndat;
|
||||
|
||||
for i=1:ndates
|
||||
|
@ -57,6 +63,7 @@ if ~isempty(o.title)
|
|||
end
|
||||
fprintf(fid, '\\toprule%%\n');
|
||||
|
||||
% Column Headers
|
||||
datedata = dates.time;
|
||||
years = unique(datedata(:, 1));
|
||||
thdr = num2cell(years, size(years, 1));
|
||||
|
@ -111,9 +118,10 @@ switch dates.freq
|
|||
end
|
||||
fprintf(fid, '%%\n');
|
||||
|
||||
vars = o.data.name;
|
||||
% Table Data
|
||||
vars = ds.name;
|
||||
nvars = size(vars);
|
||||
data = o.data.data;
|
||||
data = ds.data;
|
||||
assert(isint(o.precision));
|
||||
precision = 10^o.precision;
|
||||
dataString = [' & %.' num2str(o.precision) 'f'];
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
function S = shiftS(S)
|
||||
%function S = shiftS(S)
|
||||
%
|
||||
% Removes the first element of a one dimensional cell array.
|
||||
|
||||
% Copyright (C) 2013 Dynare Team
|
||||
%
|
|
@ -0,0 +1,5 @@
|
|||
FREQ__ = 4;
|
||||
INIT__ = '1994Q3';
|
||||
|
||||
azert = randn(100,1);
|
||||
yuiop = randn(100,1);
|
Binary file not shown.
|
@ -22,9 +22,7 @@ effstar = 1.000;
|
|||
sigma = 0.100;
|
||||
|
||||
|
||||
@#if extended_path_version
|
||||
rho = 0.800;
|
||||
@#endif
|
||||
rho = 0.800;
|
||||
|
||||
model(use_dll);
|
||||
|
||||
|
|
Loading…
Reference in New Issue