Commit 4ee3117f authored by Stéphane Adjemian's avatar Stéphane Adjemian

Added new member ops.

This member keeps track of the transformations and operations on the
variables. The name of the variables is now constant.
parent 531d78df
...@@ -66,10 +66,14 @@ o.abs_; ...@@ -66,10 +66,14 @@ o.abs_;
%$ %$
%$ if t(1) %$ if t(1)
%$ t(2) = dassert(length(p.name), 2); %$ t(2) = dassert(length(p.name), 2);
%$ t(3) = dassert(p.name{1},'abs(Variable_1)'); %$ t(3) = dassert(p.ops{1},'abs(Variable_1)');
%$ t(4) = dassert(p.name{2},'abs(Variable_2)'); %$ t(4) = dassert(p.ops{2},'abs(Variable_2)');
%$ t(5) = dassert(o.name{1},'Variable_1'); %$ t(5) = dassert(p.name{1},'Variable_1');
%$ t(6) = dassert(o.name{2},'Variable_2'); %$ t(6) = dassert(p.name{2},'Variable_2');
%$ t(7) = dassert(o.name{1},'Variable_1');
%$ t(8) = dassert(o.name{2},'Variable_2');
%$ t(9) = isempty(o.ops{1});
%$ t(10) = isempty(o.ops{2});
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
...@@ -96,13 +100,16 @@ o.abs_; ...@@ -96,13 +100,16 @@ o.abs_;
%$ t(2) = dassert(ts2.vobs,2); %$ t(2) = dassert(ts2.vobs,2);
%$ t(3) = dassert(ts2.nobs,10); %$ t(3) = dassert(ts2.nobs,10);
%$ t(4) = dassert(ts2.data,abs(A),1e-15); %$ t(4) = dassert(ts2.data,abs(A),1e-15);
%$ t(5) = dassert(ts2.name,{'abs(A1)';'abs(A2)'}); %$ t(5) = dassert(ts2.name,{'A1';'A2'});
%$ t(6) = dassert(ts2.tex,{'|A_1|';'|A_2|'}); %$ t(6) = dassert(ts2.ops,{'abs(A1)';'abs(A2)'});
%$ t(7) = dassert(ts1.vobs, 2); %$ t(7) = dassert(ts2.tex,{'A_1';'A_2'});
%$ t(8) = dassert(ts1.nobs, 10); %$ t(8) = dassert(ts1.vobs, 2);
%$ t(9) = dassert(ts1.data, A, 1e-15); %$ t(9) = dassert(ts1.nobs, 10);
%$ t(10) = dassert(ts1.name, {'A1';'A2'}); %$ t(10) = dassert(ts1.data, A, 1e-15);
%$ t(11) = dassert(ts1.tex, {'A_1';'A_2'}); %$ t(11) = dassert(ts1.name, {'A1';'A2'});
%$ t(12) = dassert(ts1.tex, {'A_1';'A_2'});
%$ t(13) = isempty(ts1.ops{1});
%$ t(14) = isempty(ts1.ops{2});
%$ end %$ end
%$ T = all(t); %$ T = all(t);
%@eof:3 %@eof:3
...@@ -128,13 +135,16 @@ o.abs_; ...@@ -128,13 +135,16 @@ o.abs_;
%$ t(2) = dassert(ts2.vobs,2); %$ t(2) = dassert(ts2.vobs,2);
%$ t(3) = dassert(ts2.nobs,10); %$ t(3) = dassert(ts2.nobs,10);
%$ t(4) = dassert(ts2.data,abs(A),1e-15); %$ t(4) = dassert(ts2.data,abs(A),1e-15);
%$ t(5) = dassert(ts2.name,{'abs(A1)';'abs(A2)'}); %$ t(5) = dassert(ts2.name,{'A1';'A2'});
%$ t(6) = dassert(ts2.tex,{'|A_1|';'|A_2|'}); %$ t(6) = dassert(ts2.tex,{'A_1';'A_2'});
%$ t(7) = dassert(ts1.vobs, 2); %$ t(7) = dassert(ts2.ops,{'abs(A1)';'abs(A2)'});
%$ t(8) = dassert(ts1.nobs, 10); %$ t(8) = dassert(ts1.vobs, 2);
%$ t(9) = dassert(ts1.data, A, 1e-15); %$ t(9) = dassert(ts1.nobs, 10);
%$ t(10) = dassert(ts1.name, {'A1';'A2'}); %$ t(10) = dassert(ts1.data, A, 1e-15);
%$ t(11) = dassert(ts1.tex, {'A_1';'A_2'}); %$ t(11) = dassert(ts1.name, {'A1';'A2'});
%$ t(12) = dassert(ts1.tex, {'A_1';'A_2'});
%$ t(13) = isempty(ts1.ops{1});
%$ t(14) = isempty(ts1.ops{2});
%$ end %$ end
%$ T = all(t); %$ T = all(t);
%@eof:4 %@eof:4
...@@ -26,8 +26,11 @@ function o = abs_(o) % --*-- Unitary tests --*-- ...@@ -26,8 +26,11 @@ function o = abs_(o) % --*-- Unitary tests --*--
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
for i=1:vobs(o) for i=1:vobs(o)
o.name(i) = {['abs(' o.name{i} ')']}; if isempty(o.ops{i})
o.tex(i) = {['|' o.tex{i} '|']}; o.ops(i) = {['abs(' o.name{i} ')']};
else
o.ops(i) = {['abs(' o.ops{i} ')']};
end
end end
o.data = abs(o.data); o.data = abs(o.data);
...@@ -51,6 +54,12 @@ o.data = abs(o.data); ...@@ -51,6 +54,12 @@ o.data = abs(o.data);
%$ t(2) = dassert(o.data, ones(10,2)); %$ t(2) = dassert(o.data, ones(10,2));
%$ t(3) = dassert(q.data, ones(10,2)); %$ t(3) = dassert(q.data, ones(10,2));
%$ t(4) = dassert(r.data, -ones(10, 2)); %$ t(4) = dassert(r.data, -ones(10, 2));
%$ t(5) = dassert(o.name{1}, 'Variable_1');
%$ t(6) = dassert(q.name{1}, 'Variable_1');
%$ t(7) = dassert(r.name{1}, 'Variable_1');
%$ t(8) = dassert(o.ops{1}, 'abs(Variable_1)');
%$ t(9) = dassert(q.ops{1}, 'abs(Variable_1)');
%$ t(10) = dassert(r.name{1}, 'Variable_1');
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
...@@ -73,12 +82,18 @@ o.data = abs(o.data); ...@@ -73,12 +82,18 @@ o.data = abs(o.data);
%$ %$
%$ if t(1) %$ if t(1)
%$ t(2) = dassert(length(o.name), 2); %$ t(2) = dassert(length(o.name), 2);
%$ t(3) = dassert(o.name{1},'abs(Variable_1)'); %$ t(3) = dassert(o.name{1},'Variable_1');
%$ t(4) = dassert(o.name{2},'abs(Variable_2)'); %$ t(4) = dassert(o.name{2},'Variable_2');
%$ t(5) = dassert(q.name{1},'abs(Variable_1)'); %$ t(5) = dassert(q.name{1},'Variable_1');
%$ t(6) = dassert(q.name{2},'abs(Variable_2)'); %$ t(6) = dassert(q.name{2},'Variable_2');
%$ t(7) = dassert(r.name{1},'Variable_1'); %$ t(7) = dassert(r.name{1},'Variable_1');
%$ t(8) = dassert(r.name{2},'Variable_2'); %$ t(8) = dassert(r.name{2},'Variable_2');
%$ t(9) = dassert(o.ops{1},'abs(Variable_1)');
%$ t(10) = dassert(o.ops{2},'abs(Variable_2)');
%$ t(11) = dassert(q.ops{1},'abs(Variable_1)');
%$ t(12) = dassert(q.ops{2},'abs(Variable_2)');
%$ t(13) = isempty(r.ops{1});
%$ t(14) = isempty(r.ops{2});
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
......
...@@ -89,12 +89,16 @@ o.baxter_king_filter_(high_frequency, low_frequency, K); ...@@ -89,12 +89,16 @@ o.baxter_king_filter_(high_frequency, low_frequency, K);
%$ t(4) = dassert(ds.init.time, [1953, 1]); %$ t(4) = dassert(ds.init.time, [1953, 1]);
%$ t(5) = dassert(ds.vobs, 1); %$ t(5) = dassert(ds.vobs, 1);
%$ t(6) = dassert(ds.nobs, 176); %$ t(6) = dassert(ds.nobs, 176);
%$ t(7) = dassert(ts.freq, 4); %$ t(7) = dassert(ds.name{1}, 'Variable_1');
%$ t(8) = dassert(ts.init.freq, 4); %$ t(8) = dassert(ds.ops{1}, 'baxter_king_filter(Variable_1, 6, 32, 12)');
%$ t(9) = dassert(ts.init.time, [1950, 1]); %$ t(9) = dassert(ts.freq, 4);
%$ t(10) = dassert(ts.vobs, 1); %$ t(10) = dassert(ts.name{1}, 'Variable_1');
%$ t(11) = dassert(ts.nobs, length(y)); %$ t(11) = dassert(ts.init.freq, 4);
%$ t(12) = dassert(ts.data, y); %$ t(12) = dassert(ts.init.time, [1950, 1]);
%$ t(13) = dassert(ts.vobs, 1);
%$ t(14) = dassert(ts.nobs, length(y));
%$ t(15) = dassert(ts.data, y);
%$ t(16) = isempty(ts.ops{1});
%$ end %$ end
%$ %$
%$ % Show results %$ % Show results
......
...@@ -94,8 +94,19 @@ o.data = tmp(K+1:end-K,:); ...@@ -94,8 +94,19 @@ o.data = tmp(K+1:end-K,:);
init = firstdate(o)+K; init = firstdate(o)+K;
o.dates = init:init+(nobs(o)-1); o.dates = init:init+(nobs(o)-1);
for i=1:vobs(o) for i=1:vobs(o)
o.name(i) = {['baxter_king_filter(' o.name{i} ')']}; if isempty(o.ops{i})
o.tex(i) = {['\text{baxter_king_filter}(' o.tex{i} ')']}; o.ops(i) = {sprintf('baxter_king_filter(%s, %s, %s, %s)', ...
o.name{i}, ...
num2str(high_frequency), ...
num2str(low_frequency), ...
num2str(K))};
else
o.ops(i) = {sprintf('baxter_king_filter(%s, %s, %s, %s)', ...
o.ops{i}, ...
num2str(high_frequency), ...
num2str(low_frequency), ...
num2str(K))};
end
end end
...@@ -116,7 +127,7 @@ end ...@@ -116,7 +127,7 @@ end
%$ % Test the routine. %$ % Test the routine.
%$ try %$ try
%$ ts = dseries(y,'1950Q1'); %$ ts = dseries(y,'1950Q1');
%$ ts = ts.baxter_king_filter_(); %$ ts.baxter_king_filter_();
%$ xx = dseries(x,'1950Q1'); %$ xx = dseries(x,'1950Q1');
%$ t(1) = 1; %$ t(1) = 1;
%$ catch %$ catch
...@@ -129,6 +140,8 @@ end ...@@ -129,6 +140,8 @@ end
%$ t(4) = dassert(ts.init.time,[1953, 1]); %$ t(4) = dassert(ts.init.time,[1953, 1]);
%$ t(5) = dassert(ts.vobs,1); %$ t(5) = dassert(ts.vobs,1);
%$ t(6) = dassert(ts.nobs,176); %$ t(6) = dassert(ts.nobs,176);
%$ t(7) = dassert(ts.name{1},'Variable_1');
%$ t(8) = dassert(ts.ops{1},'baxter_king_filter(Variable_1, 6, 32, 12)');
%$ end %$ end
%$ %$
%$ % Show results %$ % Show results
......
...@@ -49,6 +49,10 @@ o.center_(geometric); ...@@ -49,6 +49,10 @@ o.center_(geometric);
%$ if t(1) %$ if t(1)
%$ t(2) = all(all(abs(ds.data-ones(10,2))<1e-12)); %$ t(2) = all(all(abs(ds.data-ones(10,2))<1e-12));
%$ t(3) = all(all(abs(ts.data-A)<1e-12)); %$ t(3) = all(all(abs(ts.data-A)<1e-12));
%$ t(4) = dassert(ds.ops{1}, 'center(Variable_1, 1)');
%$ t(5) = dassert(ds.name{1}, 'Variable_1');
%$ t(6) = isempty(ts.ops{1});
%$ t(7) = dassert(ds.name{1}, 'Variable_1');
%$ end %$ end
%$ T = all(t); %$ T = all(t);
%@eof:1 %@eof:1
...@@ -38,6 +38,14 @@ else ...@@ -38,6 +38,14 @@ else
o.data = bsxfun(@minus, o.data, m); o.data = bsxfun(@minus, o.data, m);
end end
for i=1:o.vobs
if isempty(o.ops{i})
o.ops(i) = {sprintf('center(%s, %s)', o.name{i}, num2str(geometric))};
else
o.ops(i) = {sprintf('center(%s, %s)', o.ops{i}, num2str(geometric))};
end
end
%@test:1 %@test:1
%$ % Define a dataset. %$ % Define a dataset.
%$ A = repmat([1.005, 1.05], 10, 1); %$ A = repmat([1.005, 1.05], 10, 1);
...@@ -53,6 +61,8 @@ end ...@@ -53,6 +61,8 @@ end
%$ %$
%$ if t(1) %$ if t(1)
%$ t(2) = all(all(abs(ts.data-ones(10,2))<1e-12)); %$ t(2) = all(all(abs(ts.data-ones(10,2))<1e-12));
%$ t(3) = dassert(ts.ops{1}, 'center(Variable_1, 1)');
%$ t(4) = dassert(ts.name{1}, 'Variable_1');
%$ end %$ end
%$ T = all(t); %$ T = all(t);
%@eof:1 %@eof:1
...@@ -37,6 +37,23 @@ o.data = [o.data; bsxfun(@times,CumulatedGrowthFactors, o.data(end,:))]; ...@@ -37,6 +37,23 @@ o.data = [o.data; bsxfun(@times,CumulatedGrowthFactors, o.data(end,:))];
o.dates = firstdate(o):firstdate(o)+nobs(o); o.dates = firstdate(o):firstdate(o)+nobs(o);
for i=1:o.vobs
if isempty(o.ops{i})
if noinputname
o.ops(i) = {sprintf('chain(%s, %s)', o.name{i}, p.name{i})};
else
o.ops(i) = {sprintf('chain(%s, %s.%s)', o.name{i}, inputname(2), p.name{i})};
end
else
if noinputname
o.ops(i) = {sprintf('chain(%s, %s)', o.ops{i}, p.name{i})};
else
o.ops(i) = {sprintf('chain(%s, %s.%s)', o.ops{i}, inputname(2), p.name{i})};
end
end
end
%@test:1 %@test:1
%$ try %$ try
%$ ts = dseries([1; 2; 3; 4],dates('1950Q1')) ; %$ ts = dseries([1; 2; 3; 4],dates('1950Q1')) ;
......
...@@ -28,6 +28,7 @@ p.data = o.data; ...@@ -28,6 +28,7 @@ p.data = o.data;
p.name = o.name; p.name = o.name;
p.tex = o.tex; p.tex = o.tex;
p.dates = o.dates; p.dates = o.dates;
p.ops = o.ops;
%@test:1 %@test:1
%$ % Define a dates object %$ % Define a dates object
......
...@@ -59,9 +59,11 @@ end ...@@ -59,9 +59,11 @@ end
%$ %$
%$ if t(1) %$ if t(1)
%$ t(2) = isequal(ds.data, cumprod(A)); %$ t(2) = isequal(ds.data, cumprod(A));
%$ t(3) = isequal(ds.name{1}, 'cumprod(A1)'); %$ t(3) = isequal(ds.name{1}, 'A1');
%$ t(4) = isequal(ts.data, A); %$ t(4) = isequal(ds.ops{1}, 'cumprod(A1)');
%$ t(5) = isequal(ts.name{1}, 'A1'); %$ t(5) = isequal(ts.data, A);
%$ t(6) = isequal(ts.name{1}, 'A1');
%$ t(7) = isempty(ts.ops{1});
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
......
...@@ -61,10 +61,12 @@ switch nargin ...@@ -61,10 +61,12 @@ switch nargin
o.data = cumprodnan(o.data); o.data = cumprodnan(o.data);
end end
end end
% Change the name of the variables
for i=1:vobs(o) for i=1:vobs(o)
o.name(i) = {['cumprod(' o.name{i} ')']}; if isempty(o.ops{i})
o.tex(i) = {['\prod_t ' o.tex{i}]}; o.ops(i) = {['cumprod(' o.name{i} ')']};
else
o.ops(i) = {['cumprod(' o.ops{i} ')']};
end
end end
case 2 case 2
if isdseries(varargin{2}) if isdseries(varargin{2})
...@@ -146,7 +148,8 @@ end ...@@ -146,7 +148,8 @@ end
%$ %$
%$ if t(1) %$ if t(1)
%$ t(2) = isequal(ts.data, cumprod(A)); %$ t(2) = isequal(ts.data, cumprod(A));
%$ t(3) = isequal(ts.name{1}, 'cumprod(A1)'); %$ t(3) = isequal(ts.name{1}, 'A1');
%$ t(4) = isequal(ts.ops{1}, 'cumprod(A1)');
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
...@@ -171,8 +174,9 @@ end ...@@ -171,8 +174,9 @@ end
%$ end %$ end
%$ %$
%$ if t(1) %$ if t(1)
%$ t(2) = isequal(ts.data,cumprod(A)); %$ t(2) = isequal(ts.data, cumprod(A));
%$ t(3) = isequal(ts.name{1},'cumprod(A1)'); %$ t(3) = isequal(ts.name{1},'A1');
%$ t(4) = isequal(ts.ops{1}, 'cumprod(A1)');
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
......
...@@ -61,10 +61,12 @@ switch nargin ...@@ -61,10 +61,12 @@ switch nargin
o.data = cumsumnan(o.data); o.data = cumsumnan(o.data);
end end
end end
% Change the name of the variables
for i=1:vobs(o) for i=1:vobs(o)
o.name(i) = {['cumsum(' o.name{i} ')']}; if isempty(o.ops{i})
o.tex(i) = {['\sum_t ' o.tex{i}]}; o.ops(i) = {['cumsum(' o.name{i} ')']};
else
o.ops(i) = {['cumsum(' o.ops{i} ')']};
end
end end
case 2 case 2
if isdseries(varargin{2}) if isdseries(varargin{2})
......
...@@ -52,6 +52,14 @@ else ...@@ -52,6 +52,14 @@ else
error('dseries::detrend: Second argument must be a positive integer scalar!') error('dseries::detrend: Second argument must be a positive integer scalar!')
end end
for i=1:vobs(o)
if isempty(o.ops{i})
o.ops(i) = {sprintf('detrend(%s, %s)', o.name{i}, num2str(model))};
else
o.ops(i) = {sprintf('detrend(%s, %s)', o.ops{i}, num2str(model))};
end
end
%@test:1 %@test:1
%$ % Define a dataset. %$ % Define a dataset.
%$ a = dseries(randn(1000,3)); %$ a = dseries(randn(1000,3));
......
...@@ -22,6 +22,7 @@ properties ...@@ -22,6 +22,7 @@ properties
name = {}; % Names of the variables. name = {}; % Names of the variables.
tex = {}; % TeX names of the variables. tex = {}; % TeX names of the variables.
dates = dates(); % Dates associated to the observations. dates = dates(); % Dates associated to the observations.
ops = {}; % History of operations on the variables.
end end
methods methods
...@@ -52,6 +53,7 @@ methods ...@@ -52,6 +53,7 @@ methods
o.name = {}; o.name = {};
o.tex = {}; o.tex = {};
o.dates = dates(); o.dates = dates();
o.ops = {};
return return
case 1 case 1
if isdates(varargin{1}) if isdates(varargin{1})
...@@ -64,6 +66,7 @@ methods ...@@ -64,6 +66,7 @@ methods
o.name = {}; o.name = {};
o.tex = {}; o.tex = {};
o.dates = varargin{1}; o.dates = varargin{1};
o.ops = {};
otherwise otherwise
error('dseries:WrongInputArguments', 'Input (identified as a dates object) must have a unique element!'); error('dseries:WrongInputArguments', 'Input (identified as a dates object) must have a unique element!');
end end
...@@ -74,6 +77,7 @@ methods ...@@ -74,6 +77,7 @@ methods
o.name = varlist; o.name = varlist;
o.dates = init:init+(nobs(o)-1); o.dates = init:init+(nobs(o)-1);
o.tex = tex; o.tex = tex;
o.ops = cell(length(o.name), 1);
elseif ~isoctave() && istable(varargin{1}) elseif ~isoctave() && istable(varargin{1})
% It is assumed that the dates are in the first column. % It is assumed that the dates are in the first column.
thistable = varargin{1}; thistable = varargin{1};
...@@ -81,11 +85,13 @@ methods ...@@ -81,11 +85,13 @@ methods
o.tex = name2tex(o.name); o.tex = name2tex(o.name);
o.data = varargin{1}{:,2:end}; o.data = varargin{1}{:,2:end};
o.dates = dates(varargin{1}{1,1}{1})+(0:size(varargin{1}, 1)-1); o.dates = dates(varargin{1}{1,1}{1})+(0:size(varargin{1}, 1)-1);
o.ops = cell(length(o.name), 1);
elseif isnumeric(varargin{1}) && isequal(ndims(varargin{1}),2) elseif isnumeric(varargin{1}) && isequal(ndims(varargin{1}),2)
o.data = varargin{1}; o.data = varargin{1};
o.name = default_name(vobs(o)); o.name = default_name(vobs(o));
o.tex = name2tex(o.name); o.tex = name2tex(o.name);
o.dates = dates(1,1):dates(1,1)+(nobs(o)-1); o.dates = dates(1,1):dates(1,1)+(nobs(o)-1);
o.ops = cell(length(o.name), 1);
end end
case {2,3,4} case {2,3,4}
if isequal(nargin,2) && ischar(varargin{1}) && isdates(varargin{2}) if isequal(nargin,2) && ischar(varargin{1}) && isdates(varargin{2})
...@@ -97,6 +103,7 @@ methods ...@@ -97,6 +103,7 @@ methods
o.name = varlist; o.name = varlist;
o.dates = varargin{2}:varargin{2}+(nobs(o)-1); o.dates = varargin{2}:varargin{2}+(nobs(o)-1);
o.tex = tex; o.tex = tex;
o.ops = cell(length(o.name), 1);
return return
end end
if isequal(nargin,2) && ischar(varargin{1}) && ischar(varargin{2}) && isdate(varargin{2}) if isequal(nargin,2) && ischar(varargin{1}) && ischar(varargin{2}) && isdate(varargin{2})
...@@ -108,6 +115,7 @@ methods ...@@ -108,6 +115,7 @@ methods
o.name = varlist; o.name = varlist;
o.dates = dates(varargin{2}):dates(varargin{2})+(nobs(o)-1); o.dates = dates(varargin{2}):dates(varargin{2})+(nobs(o)-1);
o.tex = tex; o.tex = tex;
o.ops = cell(length(o.name), 1);
return return
end end
a = varargin{1}; a = varargin{1};
...@@ -168,6 +176,7 @@ methods ...@@ -168,6 +176,7 @@ methods
else else
o.name = default_name(vobs(o)); o.name = default_name(vobs(o));
end end
o.ops = cell(length(o.name), 1);
if ~isempty(d) if ~isempty(d)
if vobs(o)==length(d) if vobs(o)==length(d)
for i=1:vobs(o) for i=1:vobs(o)
...@@ -222,7 +231,7 @@ end % classdef ...@@ -222,7 +231,7 @@ end % classdef
%@eof:2 %@eof:2
%@test:3 %@test:3
%$ t = zeros(6,1); %$ t = zeros(8, 1);
%$ %$
%$ try %$ try
%$ [strfile, status] = urlwrite('http://www.dynare.org/Datasets/dseries/dynseries_test_data.m','dynseries_test_data.m'); %$ [strfile, status] = urlwrite('http://www.dynare.org/Datasets/dseries/dynseries_test_data.m','dynseries_test_data.m');
...@@ -242,13 +251,15 @@ end % classdef ...@@ -242,13 +251,15 @@ end % classdef
%$ t(4) = dassert(ts.init.time,[1994, 3]); %$ t(4) = dassert(ts.init.time,[1994, 3]);
%$ t(5) = dassert(ts.vobs,2); %$ t(5) = dassert(ts.vobs,2);
%$ t(6) = dassert(ts.nobs,100); %$ t(6) = dassert(ts.nobs,100);
%$ t(7) = dassert(length(ts.ops), 2);
%$ t(8) = isempty(ts.ops{1}) && isempty(ts.ops{2});
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
%@eof:3 %@eof:3
%@test:4 %@test:4
%$ t = zeros(6,1); %$ t = zeros(8, 1);
%$ %$
%$ try %$ try
%$ [strfile, status] = urlwrite('http://www.dynare.org/Datasets/dseries/dynseries_test_data.mat','dynseries_test_data.mat'); %$ [strfile, status] = urlwrite('http://www.dynare.org/Datasets/dseries/dynseries_test_data.mat','dynseries_test_data.mat');
...@@ -268,13 +279,15 @@ end % classdef ...@@ -268,13 +279,15 @@ end % classdef
%$ t(4) = dassert(ts.init.time,[1994, 3]); %$ t(4) = dassert(ts.init.time,[1994, 3]);
%$ t(5) = dassert(ts.vobs,2); %$ t(5) = dassert(ts.vobs,2);
%$ t(6) = dassert(ts.nobs,100); %$ t(6) = dassert(ts.nobs,100);
%$ t(7) = dassert(length(ts.ops), 2);
%$ t(8) = isempty(ts.ops{1}) && isempty(ts.ops{2});
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
%@eof:4 %@eof:4
%@test:5 %@test:5
%$ t = zeros(8,1); %$ t = zeros(10, 1);
%$ %$
%$ try %$ try
%$ [strfile, status] = urlwrite('http://www.dynare.org/Datasets/dseries/dynseries_test_data.csv','dynseries_test_data.csv'); %$ [strfile, status] = urlwrite('http://www.dynare.org/Datasets/dseries/dynseries_test_data.csv','dynseries_test_data.csv');
...@@ -296,13 +309,15 @@ end % classdef ...@@ -296,13 +309,15 @@ end % classdef
%$ t(6) = dassert(ts.nobs,4); %$ t(6) = dassert(ts.nobs,4);
%$ t(7) = dassert(ts.name,{'azert';'yuiop';'qsdfg';'jklm'}); %$ t(7) = dassert(ts.name,{'azert';'yuiop';'qsdfg';'jklm'});
%$ t(8) = dassert(ts.tex,{'azert';'yuiop';'qsdfg';'jklm'}); %$ t(8) = dassert(ts.tex,{'azert';'yuiop';'qsdfg';'jklm'});
%$ t(9) = dassert(length(ts.ops), 4);
%$ t(10) = isempty(ts.ops{1}) && isempty(ts.ops{2}) && isempty(ts.ops{3}) && isempty(ts.ops{4}) ;
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
%@eof:5 %@eof:5
%@test:6 %@test:6
%$ t = zeros(8,1); %$ t = zeros(10, 1);
%$ %$
%$ try %$ try
%$ ts = dseries(transpose(1:5),[]); %$ ts = dseries(transpose(1:5),[]);
...@@ -319,13 +334,15 @@ end % classdef ...@@ -319,13 +334,15 @@ end % classdef
%$ t(6) = dassert(ts.nobs,5); %$ t(6) = dassert(ts.nobs,5);
%$ t(7) = dassert(ts.name,{'Variable_1'}); %$ t(7) = dassert(ts.name,{'Variable_1'});
%$ t(8) = dassert(ts.tex,{'Variable\\_1'}); %$ t(8) = dassert(ts.tex,{'Variable\\_1'});
%$ t(9) = dassert(length(ts.ops), 1);
%$ t(10) = isempty(ts.ops{1});
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
%@eof:6 %@eof:6
%@test:7 %@test:7
%$ t = zeros(8,1); %$ t = zeros(10, 1);
%$ %$
%$ try %$ try
%$ ts = dseries(transpose(1:5),'1950Q1'); %$ ts = dseries(transpose(1:5),'1950Q1');
...@@ -342,13 +359,15 @@ end % classdef ...@@ -342,13 +359,15 @@ end % classdef
%$ t(6) = dassert(ts.nobs,5); %$ t(6) = dassert(ts.nobs,5);
%$ t(7) = dassert(ts.name,{'Variable_1'}); %$ t(7) = dassert(ts.name,{'Variable_1'});
%$ t(8) = dassert(ts.tex,{'Variable\\_1'}); %$ t(8) = dassert(ts.tex,{'Variable\\_1'});
%$ t(9) = dassert(length(ts.ops), 1);
%$ t(10) = isempty(ts.ops{1});
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
%@eof:7 %@eof:7
%@test:8 %@test:8
%$ t = zeros(8,1); %$ t = zeros(10, 1);
%$ %$
%$ try %$ try
%$ ts = dseries([transpose(1:5), transpose(6:10)],'1950q1',{'Output'; 'Consumption'}, {'Y_t'; 'C_t'}); %$ ts = dseries([transpose(1:5), transpose(6:10)],'1950q1',{'Output'; 'Consumption'}, {'Y_t'; 'C_t'});
...@@ -365,6 +384,8 @@ end % classdef ...@@ -365,6 +384,8 @@ end % classdef
%$ t(6) = dassert(ts.nobs,5); %$ t(6) = dassert(ts.nobs,5);
%$ t(7) = dassert(ts.name,{'Output'; 'Consumption'}); %$ t(7) = dassert(ts.name,{'Output'; 'Consumption'});
%$ t(8) = dassert(ts.tex,{'Y_t'; 'C_t'}); %$ t(8) = dassert(ts.tex,{'Y_t'; 'C_t'});
%$ t(9) = dassert(length(ts.ops), 2);
%$ t(10) = isempty(ts.ops{1}) && isempty(ts.ops{2});
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
...@@ -400,6 +421,8 @@ end % classdef ...@@ -400,6 +421,8 @@ end % classdef
%$ t(6) = dassert(ts.nobs,5); %$ t(6) = dassert(ts.nobs,5);
%$ t(7) = dassert(ts.name,{'GDP';'Consumption';'CPI'}); %$ t(7) = dassert(ts.name,{'GDP';'Consumption';'CPI'});
%$ t(8) = dassert(ts.tex,{'GDP';'Consumption';'CPI'}); %$ t(8) = dassert(ts.tex,{'GDP';'Consumption';'CPI'});
%$ t(9) = dassert(length(ts.ops), 3);
%$ t(10) = isempty(ts.ops{1}) && isempty(ts.ops{2}) && isempty(ts.ops{3});
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
...@@ -435,6 +458,8 @@ end % classdef ...@@ -435,6 +458,8 @@ end % classdef
%$ t(6) = dassert(ts.nobs,5); %$ t(6) = dassert(ts.nobs,5);
%$ t(7) = dassert(ts.name,{'Variable_1';'Variable_2';'Variable_3'}); %$ t(7) = dassert(ts.name,{'Variable_1';'Variable_2';'Variable_3'});
%$ t(8) = dassert(ts.tex,{'Variable\\_1';'Variable\\_2';'Variable\\_3'}); %$ t(8) = dassert(ts.tex,{'Variable\\_1';'Variable\\_2';'Variable\\_3'});
%$ t(9) = dassert(length(ts.ops), 3);
%$ t(10) = isempty(ts.ops{1}) && isempty(ts.ops{2}) && isempty(ts.ops{3});
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
...@@ -470,6 +495,8 @@ end % classdef ...@@ -470,6 +495,8 @@ end % classdef
%$ t(6) = dassert(ts.nobs,5); %$ t(6) = dassert(ts.nobs,5);
%$ t(7) = dassert(ts.name,{'Variable_1';'Variable_2';'Variable_3'}); %$ t(7) = dassert(ts.name,{'Variable_1';'Variable_2';'Variable_3'});
%$ t(8) = dassert(ts.tex,{'Variable\\_1';'Variable\\_2';'Variable\\_3'}); %$ t(8) = dassert(ts.tex,{'Variable\\_1';'Variable\\_2';'Variable\\_3'});
%$ t(9) = dassert(length(ts.ops), 3);
%$ t(10) = isempty(ts.ops{1}) && isempty(ts.ops{2}) && isempty(ts.ops{3});
%$ end %$ end
%$ %$
%$ T = all(t); %$ T = all(t);
...@@ -505,13 +532,15 @@ end % classdef ...@@ -505,13 +532,15 @@ end % classdef
%$ t(6) = dassert(ts.nobs,5); %$ t(6) = dassert(ts.nobs,5);
%$ t(7) = dassert(ts.name,{'GDP';'Consumption';'CPI'}); %$ t(7) = dassert(ts.name,{'GDP';'Consumption';'CPI'});
%$ t(8) = dassert(ts.tex,{'GDP';'Consumption';'CPI'}); %$ t(8) = dassert(ts.tex,{'GDP';'Consumption';'CPI'});
%$ t(9) = dassert(length(ts.ops), 3);
%$ t(10) = isempty(ts.ops{1}) && isempty(ts.ops{2}) && isempty(ts.ops{3});
%$ end