diff --git a/.gitignore b/.gitignore index 17eea65cc7480ad20af3a7e2561b46ae58498aef..670dfeb97a923e2c775af0b2cbb9e1505f74031b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *~ +.DS_Store externals/* src/git.info src/git.last-commit-hash \ No newline at end of file diff --git a/src/@dseries/onesidedhpcycle.m b/src/@dseries/onesidedhpcycle.m index 34044ffb489b93a36b70ac41e08505261e1953d0..a9f2dca48726ebb481a321a031e25ba3485c2f32 100644 --- a/src/@dseries/onesidedhpcycle.m +++ b/src/@dseries/onesidedhpcycle.m @@ -1,4 +1,4 @@ -function o = onesidedhpcycle(o, lambda) % --*-- Unitary tests --*-- +function o = onesidedhpcycle(o, lambda, init) % --*-- Unitary tests --*-- % Extracts the cycle component from a dseries object using the one sided HP filter. % @@ -28,14 +28,23 @@ function o = onesidedhpcycle(o, lambda) % --*-- Unitary tests --*-- if nargin>1 if lambda<=0 - error(['dseries::onesidedhptrend: Lambda must be a positive integer!']) + error(['dseries::onesidedhpcycle: Lambda must be a positive integer!']) + end + if nargin>2 + if ~isequal(init, 'hpfilter') + error('dseries::onesidedhpcycle: Unknown option!') + end end else lambda = []; end o = copy(o); -o.onesidedhpcycle_(lambda); +if nargin<3 + o.onesidedhpcycle_(lambda); +else + o.onesidedhpcycle_(lambda, init); +end return diff --git a/src/@dseries/onesidedhpcycle_.m b/src/@dseries/onesidedhpcycle_.m index e92755e68164588fc393088f2539ca38f08598d6..61d89b845c8bcf48b17c6723a057750d44610fdc 100644 --- a/src/@dseries/onesidedhpcycle_.m +++ b/src/@dseries/onesidedhpcycle_.m @@ -1,4 +1,4 @@ -function o = onesidedhpcycle_(o, lambda) % --*-- Unitary tests --*-- +function o = onesidedhpcycle_(o, lambda, init) % --*-- Unitary tests --*-- % Extracts the cycle component from a dseries object using a one sided HP filter. % @@ -28,7 +28,12 @@ function o = onesidedhpcycle_(o, lambda) % --*-- Unitary tests --*-- if nargin>1 if lambda<=0 - error(['dseries::onesidedhptrend: Lambda must be a positive integer!']) + error('dseries::onesidedhpcycle: Lambda must be a positive integer!') + end + if nargin>2 + if ~isequal(init, 'hpfilter') + error('dseries::onesidedhpcycle: Unknown option!') + end end else lambda = []; @@ -37,20 +42,42 @@ end for i=1:vobs(o) if isempty(o.ops{i}) if isempty(lambda) - o.ops(i) = {sprintf('onesidedhpcycle(%s, [])', o.name{i})}; + if nargin>2 + o.ops(i) = {sprintf('onesidedhpcycle(%s, [], ''%s'')', o.name{i}, init)}; + else + o.ops(i) = {sprintf('onesidedhpcycle(%s, [])', o.name{i})}; + end else - o.ops(i) = {sprintf('onesidedhpcycle(%s, %s)', o.name{i}, num2str(lambda))}; + if nargin>2 + o.ops(i) = {sprintf('onesidedhpcycle(%s, %s, ''%s'')', o.name{i}, num2str(lambda), init)}; + else + o.ops(i) = {sprintf('onesidedhpcycle(%s, %s)', o.name{i}, num2str(lambda))}; + end end else if isempty(lambda) - o.ops(i) = {sprintf('onesidedhpcycle(%s, [])', o.ops{i})}; + if nargin>2 + o.ops(i) = {sprintf('onesidedhpcycle(%s, [], ''%s'')', o.ops{i}, init)}; + else + o.ops(i) = {sprintf('onesidedhpcycle(%s, [])', o.ops{i})}; + end else - o.ops(i) = {sprintf('onesidedhpcycle(%s, %s)', o.ops{i}, num2str(lambda))}; + if nargin>2 + o.ops(i) = {sprintf('onesidedhpcycle(%s, %s, ''%s'')', o.ops{i}, num2str(lambda), init)}; + else + o.ops(i) = {sprintf('onesidedhpcycle(%s, %s)', o.ops{i}, num2str(lambda))}; + end end end end -[~, o.data] = one_sided_hp_filter(o.data, lambda); +if nargin>2 + trend = o.hptrend(lambda); + x0 = trend.data(1:2,:); + [~, o.data] = one_sided_hp_filter(o.data, lambda, x0); +else + [~, o.data] = one_sided_hp_filter(o.data, lambda); +end return diff --git a/src/@dseries/onesidedhptrend.m b/src/@dseries/onesidedhptrend.m index 033588c0907bf2f74c21db81cf9459b2d5df9f24..cb0e2fc7641c819914a6f4fbcf9de2768bcdd4e4 100644 --- a/src/@dseries/onesidedhptrend.m +++ b/src/@dseries/onesidedhptrend.m @@ -1,4 +1,4 @@ -function o = onesidedhptrend(o, lambda) % --*-- Unitary tests --*-- +function o = onesidedhptrend(o, lambda, init) % --*-- Unitary tests --*-- % Extracts the trend component from a dseries object using the one sided HP filter. % @@ -30,12 +30,21 @@ if nargin>1 if lambda<=0 error(['dseries::onesidedhptrend: Lambda must be a positive integer!']) end + if nargin>2 + if ~isequal(init, 'hpfilter') + error('dseries::onesidedhpcycle: Unknown option!') + end + end else lambda = []; end o = copy(o); -o.onesidedhptrend_(lambda); +if nargin<3 + o.onesidedhptrend_(lambda); +else + o.onesidedhptrend_(lambda, init); +end return diff --git a/src/@dseries/onesidedhptrend_.m b/src/@dseries/onesidedhptrend_.m index 620f7425966b88e34a4fffd72864d7d660a7ac1e..eb881ced658d663f054402f17f9348c1402098ba 100644 --- a/src/@dseries/onesidedhptrend_.m +++ b/src/@dseries/onesidedhptrend_.m @@ -30,6 +30,11 @@ if nargin>1 if lambda<=0 error(['dseries::onesidedhptrend: Lambda must be a positive integer!']) end + if nargin>2 + if ~isequal(init, 'hpfilter') + error('dseries::onesidedhptrend: Unknown option!') + end + end else lambda = []; end @@ -37,20 +42,42 @@ end for i=1:vobs(o) if isempty(o.ops{i}) if isempty(lambda) - o.ops(i) = {sprintf('onesidedhptrend(%s, [])', o.name{i})}; + if nargin>2 + o.ops(i) = {sprintf('onesidedhptrend(%s, [], ''%s'')', o.name{i}, init)}; + else + o.ops(i) = {sprintf('onesidedhptrend(%s, [])', o.name{i})}; + end else - o.ops(i) = {sprintf('onesidedhptrend(%s, %s)', o.name{i}, num2str(lambda))}; + if nargin>2 + o.ops(i) = {sprintf('onesidedhptrend(%s, %s, ''%s'')', o.name{i}, num2str(lambda), init)}; + else + o.ops(i) = {sprintf('onesidedhptrend(%s, %s)', o.name{i}, num2str(lambda))}; + end end else if isempty(lambda) - o.ops(i) = {sprintf('onesidedhptrend(%s, [])', o.ops{i})}; + if nargin>2 + o.ops(i) = {sprintf('onesidedhptrend(%s, [], ''%s'')', o.ops{i}, init)}; + else + o.ops(i) = {sprintf('onesidedhptrend(%s, [])', o.ops{i})}; + end else - o.ops(i) = {sprintf('onesidedhptrend(%s, %s)', o.ops{i}, num2str(lambda))}; + if nargin>2 + o.ops(i) = {sprintf('onesidedhptrend(%s, %s, ''%s'')', o.ops{i}, num2str(lambda), init)}; + else + o.ops(i) = {sprintf('onesidedhptrend(%s, %s)', o.ops{i}, num2str(lambda))}; + end end end end -o.data = one_sided_hp_filter(o.data, lambda); +if nargin>2 + trend = o.hptrend(lambda); + x0 = trend.data(1:2,:); + o.data = one_sided_hp_filter(o.data, lambda, x0); +else + o.data = one_sided_hp_filter(o.data, lambda); +end return diff --git a/src/@dseries/subsref.m b/src/@dseries/subsref.m index ec8b082b1480a079de0e7485d3fc6ef4f7abede0..9f6f47f55b7a946cfeeeb888be6a2933b7d8e2eb 100644 --- a/src/@dseries/subsref.m +++ b/src/@dseries/subsref.m @@ -70,11 +70,6 @@ switch S(1).type error(['dseries::subsref: ' S(1).subs ' is not a method but a member!']) end B = builtin('subsref', A, S(1)); - case {'log','log_','exp','exp_','ygrowth','ygrowth_','qgrowth','qgrowth_','ydiff','ydiff_','qdiff','qdiff_','abs','abs_','isnan','firstdate','firstobservedperiod','lastobservedperiod','lineartrend'} % Give "dot access" to public methods without args. - B = feval(S(1).subs,A); - if length(S)>1 && isequal(S(2).type,'()') && isempty(S(2).subs) - S = shiftS(S,1); - end case 'nobs' % Returns the number of observations. B = rows(A.data); @@ -90,49 +85,8 @@ switch S(1).type case 'freq' % Returns an integer characterizing the data frequency (1, 4, 12 or 52) B = A.dates.freq; - case {'lag','lag_','lead','lead_','hptrend','hptrend_','hpcycle','hpcycle_','onesidedhptrend','onesidedhptrend_','onesidedhpcycle','onesidedhpcycle_','chain','chain_','detrend','detrend_','exist','mean','std','center','center_'} % Methods with less than two arguments. - if length(S)>1 && isequal(S(2).type,'()') - if isempty(S(2).subs) - B = feval(S(1).subs,A); - S = shiftS(S,1); - else - if ~ischar(S(2).subs{1}) && length(S(2).subs{1})>1 - error(['dseries::subsref: ' S(1).subs{1} ' method admits no more than one argument!']) - end - B = feval(S(1).subs,A,S(2).subs{1}); - S = shiftS(S,1); - end - else - B = feval(S(1).subs,A); - end - case {'cumsum','cumsum_','insert','pop','pop_','cumprod','cumprod_','remove','remove_'} % Methods with less than three argument. - if length(S)>1 && isequal(S(2).type,'()') - if isempty(S(2).subs) - B = feval(S(1).subs,A); - S = shiftS(S,1); - else - if length(S(2).subs)>2 - error(['dseries::subsref: ' S(1).subs{1} ' method admits no more than two arguments!']) - end - B = feval(S(1).subs,A,S(2).subs{:}); - S = shiftS(S,1); - end - else - B = feval(S(1).subs,A); - end - case {'baxter_king_filter', 'baxter_king_filter_'} - if length(S)>1 && isequal(S(2).type,'()') - if isempty(S(2).subs) - B = feval(S(1).subs,A); - S = shiftS(S,1); - else - B = feval(S(1).subs,A,S(2).subs{1}) - S = shiftS(S,1); - end - else - B = feval(S(1).subs,A); - end - case 'save' % Save dseries object on disk (default is a csv file). + case 'save' + % Save dseries object on disk (default is a mat file). B = NaN; if isequal(length(S),2) if strcmp(S(2).type,'()') @@ -154,6 +108,47 @@ switch S(1).type else error('dseries::subsref: Call to save method must come in last position!') end + case {'baxter_king_filter', 'baxter_king_filter_', ... + 'cumsum','cumsum_', ... + 'insert', ... + 'pop','pop_', ... + 'cumprod','cumprod_', ... + 'remove','remove_', ... + 'onesidedhptrend','onesidedhptrend_', ... + 'onesidedhpcycle','onesidedhpcycle_', ... + 'lag','lag_', ... + 'lead','lead_', ... + 'hptrend','hptrend_', ... + 'hpcycle','hpcycle_', ... + 'chain','chain_', ... + 'detrend','detrend_', ... + 'exist', ... + 'mean', ... + 'std', ... + 'center','center_', ... + 'log','log_', ... + 'exp','exp_', ... + 'ygrowth','ygrowth_', ... + 'qgrowth','qgrowth_', ... + 'ydiff','ydiff_', ... + 'qdiff','qdiff_', ... + 'abs','abs_', ... + 'isnan', ... + 'firstdate', ... + 'firstobservedperiod', ... + 'lastobservedperiod', ... + 'lineartrend'} + if length(S)>1 && isequal(S(2).type,'()') + if isempty(S(2).subs) + B = feval(S(1).subs,A); + S = shiftS(S,1); + else + B = feval(S(1).subs,A,S(2).subs{:}); + S = shiftS(S,1); + end + else + B = feval(S(1).subs,A); + end case 'size' if isequal(length(S),2) && strcmp(S(2).type,'()') if isempty(S(2).subs) @@ -184,6 +179,10 @@ switch S(1).type B.tex = A.tex(ndx); B.dates = A.dates; B.ops = A.ops(ndx); + tagnames = fieldnames(A.tags); + for i=1:length(tagnames) + B.tags.(tagnames{i}) = A.tags.(tagnames{i})(ndx); + end else error('dseries::subsref: Unknown public method, public member or variable!') end @@ -226,6 +225,8 @@ switch S(1).type B.name = A.name; B.tex = A.tex; B.dates = A.dates(tdx); + B.ops = A.ops; + B.tags = A.tags; elseif isvector(S(1).subs{1}) && all(isint(S(1).subs{1})) error('dseries::subsref: It is not possible to select observations with a vector of integers. You have to index with a dates object instead!'); else @@ -244,6 +245,11 @@ switch S(1).type B.name = A.name(idx); B.tex = A.tex(idx); B.dates = A.dates; + B.ops = A.ops(idx); + tagnames = fieldnames(A.tags); + for i=1:length(tagnames) + B.tags.(tagnames{i}) = A.tags.(tagnames{i})(idx); + end else error('dseries::subsref: What the Hell are you tryin'' to do?!') end diff --git a/src/@x13/print.m b/src/@x13/print.m index aaff0036950b6737fd65eaf78fa4fd1c240276f8..fa8952b83b7dcaa54cc625c0b10eee62d0bf43fe 100644 --- a/src/@x13/print.m +++ b/src/@x13/print.m @@ -216,4 +216,178 @@ if ismember('x11', o.commands) fprintf(fid, '}\n\n'); end +% Write FORCE block +if ismember('force', o.commands) + fprintf(fid, 'force {'); + if ~all(cellfun(@isempty, struct2cell(o.force))) + fprintf(fid, '\n'); + optionnames = fieldnames(o.force); + for i=1:length(optionnames) + if ~isempty(o.force.(optionnames{i})) + printoption(fid, optionnames{i}, o.force.(optionnames{i})); + end + end + end + fprintf(fid, '}\n\n'); +end + +% Write HISTORY block +if ismember('history', o.commands) + fprintf(fid, 'history {'); + if ~all(cellfun(@isempty, struct2cell(o.history))) + fprintf(fid, '\n'); + optionnames = fieldnames(o.history); + for i=1:length(optionnames) + if ~isempty(o.history.(optionnames{i})) + printoption(fid, optionnames{i}, o.history.(optionnames{i})); + end + end + end + fprintf(fid, '}\n\n'); +end + +% Write METADATA block +if ismember('metadata', o.commands) + fprintf(fid, 'metadata {'); + if ~all(cellfun(@isempty, struct2cell(o.metadata))) + fprintf(fid, '\n'); + optionnames = fieldnames(o.metadata); + for i=1:length(optionnames) + if ~isempty(o.metadata.(optionnames{i})) + printoption(fid, optionnames{i}, o.metadata.(optionnames{i})); + end + end + end + fprintf(fid, '}\n\n'); +end + +% Write IDENTIFY block +if ismember('identify', o.commands) + fprintf(fid, 'identify {'); + if ~all(cellfun(@isempty, struct2cell(o.identify))) + fprintf(fid, '\n'); + optionnames = fieldnames(o.identify); + for i=1:length(optionnames) + if ~isempty(o.identify.(optionnames{i})) + printoption(fid, optionnames{i}, o.identify.(optionnames{i})); + end + end + end + fprintf(fid, '}\n\n'); +end + +% Write PICKMDL block +if ismember('pickmdl', o.commands) + fprintf(fid, 'pickmdl {'); + if ~all(cellfun(@isempty, struct2cell(o.pickmdl))) + fprintf(fid, '\n'); + optionnames = fieldnames(o.pickmdl); + for i=1:length(optionnames) + if ~isempty(o.pickmdl.(optionnames{i})) + printoption(fid, optionnames{i}, o.pickmdl.(optionnames{i})); + end + end + end + fprintf(fid, '}\n\n'); +end + +% Write SEATS block +if ismember('seats', o.commands) + fprintf(fid, 'seats {'); + if ~all(cellfun(@isempty, struct2cell(o.seats))) + fprintf(fid, '\n'); + optionnames = fieldnames(o.seats); + for i=1:length(optionnames) + if ~isempty(o.seats.(optionnames{i})) + printoption(fid, optionnames{i}, o.seats.(optionnames{i})); + end + end + end + fprintf(fid, '}\n\n'); +end + +% Write SLIDINGSPANS block +if ismember('slidingspans', o.commands) + fprintf(fid, 'slidingspans {'); + if ~all(cellfun(@isempty, struct2cell(o.slidingspans))) + fprintf(fid, '\n'); + optionnames = fieldnames(o.slidingspans); + for i=1:length(optionnames) + if ~isempty(o.slidingspans.(optionnames{i})) + printoption(fid, optionnames{i}, o.slidingspans.(optionnames{i})); + end + end + end + fprintf(fid, '}\n\n'); +end + +% Write SPECTRUM block +if ismember('spectrum', o.commands) + fprintf(fid, 'spectrum {'); + if ~all(cellfun(@isempty, struct2cell(o.spectrum))) + fprintf(fid, '\n'); + optionnames = fieldnames(o.spectrum); + for i=1:length(optionnames) + if ~isempty(o.spectrum.(optionnames{i})) + printoption(fid, optionnames{i}, o.spectrum.(optionnames{i})); + end + end + end + fprintf(fid, '}\n\n'); +end + +% Write X11REGRESSION block +if ismember('x11regression', o.commands) + fprintf(fid, 'x11regression {'); + if ~all(cellfun(@isempty, struct2cell(o.x11regression))) + optionnames = fieldnames(o.x11regression); + fprintf(fid, '\n'); + for i=1:length(optionnames) + if ~isempty(o.x11regression.(optionnames{i})) + if isequal(optionnames{i}, 'user') % Write needed data to a file. + % Determine the set of needed data + conditionningvariables = strsplit(o.x11regression.user, {',' , '(' , ')' , ' '}); + conditionningvariables = conditionningvariables(~cellfun(@isempty,conditionningvariables)); + % Check that these data are available. + for i=1:length(conditionningvariables) + if ~ismember(conditionningvariables{i}, o.x.name) + fclose(fid); + error('x13:x11regression: Variable %s is unkonwn', conditionningvariables{i}) + end + end + % Select the data. + if length(conditionningvariables)<vobs(o.x) + x = o.x{conditionningvariables{:}}; + else + x= o.x; + end + % Print user statement. + fprintf(fid, ' user = %s\n', o.x11regression.user); + % Print data statement. + fprintf(fid, ' data = %s\n', sprintf(data2txt(x.data))); + elseif isequal(optionnames{i}, 'start') + if ischar(o.x11regression.start) + if isdate(o.x11regression.start) + PERIOD = dates(o.x11regression.start); + else + error('x13:x11regression: Option start cannot be interpreted as a date!') + end + elseif isdates(o.x11regression.start) + PERIOD = o.x11regression.start; + else + error('x13:x11regression: Option start cannot be interpreted as a date!') + end + printstart(fid, PERIOD); + else + printoption(fid, optionnames{i}, o.x11regression.(optionnames{i})); + end + end + end + if ~isempty(o.x) && isempty(o.x11regression.start) + fprintf(fid, ' start = %i.%i\n', year(o.x.init), subperiod(o.x.init)); + end + end + fprintf(fid, '}\n\n'); +end + fclose(fid); \ No newline at end of file diff --git a/src/@x13/run.m b/src/@x13/run.m index e414d10cad07ced40466e31be55079e81c3b5070..2acb8018ad3935eb8c4f0d2657a6908bc84eb21b 100644 --- a/src/@x13/run.m +++ b/src/@x13/run.m @@ -74,5 +74,288 @@ if ~all(cellfun(@isempty, struct2cell(o.forecast))) end end +% Save results related to the TRANSFORM command +if ~all(cellfun(@isempty, struct2cell(o.transform))) + if ~isempty(o.transform.save) + savedoutput = strsplit(o.transform.save, {',' , '(' , ')' , ' '}); + savedoutput = savedoutput(~cellfun('isempty', savedoutput)); + for i=1:length(savedoutput) + if exist(sprintf('%s.%s', basename, lower(savedoutput{i}))) + tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i}))); + data = tmp.data; + o.results.(savedoutput{i}) = dseries(data(:,2), o.y.init, savedoutput{i}); + end + end + end +end + +% Save results related to the OUTLIER command +if ~all(cellfun(@isempty, struct2cell(o.outlier))) + if ~isempty(o.outlier.save) + savedoutput = strsplit(o.outlier.save, {',' , '(' , ')' , ' '}); + savedoutput = savedoutput(~cellfun('isempty', savedoutput)); + for i=1:length(savedoutput) + if exist(sprintf('%s.%s', basename, lower(savedoutput{i}))) + tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i}))); + data = tmp.data; + if lower(savedoutput{i}) == 'fts' + header = strjoin(tmp.textdata(1)); + header = strsplit(header, {'\t'}); + header = header(1,2:end); + o.results.(savedoutput{i}) = dseries(data(:,2:end), o.y.init, regexprep(header,'\(|\)','')); + elseif lower(savedoutput{i}) == 'oit' + header = strjoin(tmp.textdata(1,1)); + header = strsplit(header, {'\t'}); + header = header(1,4:end); + info = tmp.textdata(3:end,3); + for j = 1:numel(info) + flag = strjoin(info(j)); + o.results.(savedoutput{i}).(['outlier_' num2str(j)]).type = flag(1:2); + o.results.(savedoutput{i}).(['outlier_' num2str(j)]).date(1,1) = str2double(flag(3:strfind(flag,'.')-1)); + o.results.(savedoutput{i}).(['outlier_' num2str(j)]).date(1,2) = str2double(flag(strfind(flag,'.')+1:end)); + o.results.(savedoutput{i}).(['outlier_' num2str(j)]).(header{1}) = data(j,1);% medrmse + o.results.(savedoutput{i}).(['outlier_' num2str(j)]).(header{2}) = data(j,2);% rmse + o.results.(savedoutput{i}).(['outlier_' num2str(j)]).(header{3}) = data(j,3);% t-stat + end + end + end + end + end +end + +% Save results related to the SLIDINGSPANS command +if ~all(cellfun(@isempty, struct2cell(o.slidingspans))) + if ~isempty(o.slidingspans.save) + savedoutput = strsplit(o.slidingspans.save, {',' , '(' , ')' , ' '}); + savedoutput = savedoutput(~cellfun('isempty', savedoutput)); + for i=1:length(savedoutput) + if exist(sprintf('%s.%s', basename, lower(savedoutput{i}))) + tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i}))); + data = tmp.data; + header = strjoin(tmp.textdata(1)); + header = strsplit(header, {'\t'}); + header = header(1,2:end); + % In this case, the initial date is not the start of the series provided + startdate = num2str(data(1,1)); + startdate = dates(o.y.dates.freq,str2double(startdate(1:4)),str2double(startdate(5:6))); + o.results.(savedoutput{i}) = dseries(data(:,2:end),startdate, regexprep(header,'%','pct')); + end + end + end +end + +% Save results related to the IDENTIFY command +if ~all(cellfun(@isempty, struct2cell(o.identify))) + if ~isempty(o.identify.save) + savedoutput = strsplit(o.identify.save, {',' , '(' , ')' , ' '}); + savedoutput = savedoutput(~cellfun('isempty', savedoutput)); + for i=1:length(savedoutput) + if exist(sprintf('%s.%s', basename, lower(savedoutput{i}))) + tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i}))); + data = tmp.data; + header = strjoin(tmp.textdata(3,1)); + header = strsplit(header, {'\t'}); + header = header(1,2:end); + for j = 1:length(data) + for k = 1:numel(header) + o.results.(savedoutput{i}).(['lag' num2str(j)]).(strjoin(regexprep(header(k),'(\.||\-)',''))) = data(j,k+1); + end + end + end + end + end +end + +% Save results related to the CHECK command +if ~all(cellfun(@isempty, struct2cell(o.check))) + if ~isempty(o.check.save) + savedoutput = strsplit(o.check.save, {',' , '(' , ')' , ' '}); + savedoutput = savedoutput(~cellfun('isempty', savedoutput)); + for i=1:length(savedoutput) + if exist(sprintf('%s.%s', basename, lower(savedoutput{i}))) + % if "ac2" is selected and output is treated as a table/struct, there will be a + % dimension error. As long as there is no fix, ac2 is saved as text. + if lower(savedoutput{i}) == 'ac2' + o.results.(savedoutput{i}) = fileread(sprintf('%s.ac2', basename)); + else + tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i}))); + data = tmp.data; + header = strjoin(tmp.textdata(1,1)); + header = strsplit(header, {'\t'}); + header = header(1,2:end); + for j = 1:length(data) + for k = 1:numel(header) + o.results.(savedoutput{i}).(['lag' num2str(j)]).(strjoin(regexprep(header(k),'(\.||\-)',''))) = data(j,k+1); + end + end + end + end + end + end +end + +% Save results related to the FORCE command +if ~all(cellfun(@isempty, struct2cell(o.force))) + if ~isempty(o.force.save) + savedoutput = strsplit(o.force.save, {',' , '(' , ')' , ' '}); + savedoutput = savedoutput(~cellfun('isempty', savedoutput)); + for i=1:length(savedoutput) + if exist(sprintf('%s.%s', basename, lower(savedoutput{i}))) + tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i}))); + data = tmp.data; + o.results.(savedoutput{i}) = dseries(data(:,2), o.y.init, savedoutput{i}); + end + end + end +end + +% Save results related to the SPECTRUM command +if ~all(cellfun(@isempty, struct2cell(o.spectrum))) + if ~isempty(o.spectrum.save) + savedoutput = strsplit(o.spectrum.save, {',' , '(' , ')' , ' '}); + savedoutput = savedoutput(~cellfun('isempty', savedoutput)); + for i=1:length(savedoutput) + if exist(sprintf('%s.%s', basename, lower(savedoutput{i}))) + tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i}))); + data = tmp.data; + header = strjoin(tmp.textdata(1,1)); + header = strsplit(header, {'\t'}); + header = regexprep(header(2:end),'10','Ten'); + for j = 1:numel(header) + o.results.(savedoutput{i}).(strjoin(regexprep(header(j),'(\*||\(||\))',''))) = data(:,j+1); + end + end + end + end +end + +% Save results related to the SEATS command +if ~all(cellfun(@isempty, struct2cell(o.seats))) + if ~isempty(o.seats.save) + savedoutput = strsplit(o.seats.save, {',' , '(' , ')' , ' '}); + savedoutput = savedoutput(~cellfun('isempty', savedoutput)); + for i=1:length(savedoutput) + if exist(sprintf('%s.%s', basename, lower(savedoutput{i}))) + tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i}))); + data = tmp.data; + o.results.(savedoutput{i}) = dseries(data(:,2), o.y.init, savedoutput{i}); + end + end + end + o.results.tbs = fileread(sprintf('%s.tbs', basename)); +end + +% Save results related to the X11REGRESSION command +if ~all(cellfun(@isempty, struct2cell(o.x11regression))) + if ~isempty(o.x11regression.save) + savedoutput = strsplit(o.x11regression.save, {',' , '(' , ')' , ' '}); + savedoutput = savedoutput(~cellfun('isempty', savedoutput)); + for i=1:length(savedoutput) + if exist(sprintf('%s.%s', basename, lower(savedoutput{i}))) + if lower(savedoutput{i}) == 'xrc' + o.results.out = fileread(sprintf('%s.xrc', basename)); + else + tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i}))); + data = tmp.data; + o.results.(savedoutput{i}) = dseries(data(:,2), o.y.init, savedoutput{i}); + end + end + end + end +end + +% Save results related to the ESTIMATE command +if ~all(cellfun(@isempty, struct2cell(o.estimate))) + if ~isempty(o.estimate.save) + savedoutput = strsplit(o.estimate.save, {',' , '(' , ')' , ' '}); + savedoutput = savedoutput(~cellfun('isempty', savedoutput)); + for i = 1:length(savedoutput) + if exist(sprintf('%s.%s', basename, lower(savedoutput{i}))) + % The .est file cannot be read straightforwardly using + % importdata, so it is treated separately: + if lower(savedoutput{i}) == 'est' + fid = fopen(sprintf('%s.%s', basename, lower(savedoutput{i}))); + fid2 = fopen(sprintf('%s.estx', basename), 'w'); + r = 1; + s = 0; + while s<=1 + a = fgetl(fid); + if a ~= -1 + output{r,1} = a; + fprintf(fid2,[a '\n']); + else + s = s+1; + end + r = r+1; + end + o.results.(savedoutput{i}) = fileread(sprintf('%s.estx', basename)); + else + tmp = importdata(sprintf('%s.%s', basename, lower(savedoutput{i}))); + data = tmp.data; + end + + if lower(savedoutput{i}) == 'lks' + for j = 1:numel(tmp.textdata) + o.results.(savedoutput{i}).(tmp.textdata{j}) = data(j); + end + elseif lower(savedoutput{i}) == 'ref' + header = strjoin(tmp.textdata(1,1)); + header = strsplit(header, {'\t'}); + header = regexprep(header(1,2:end),'( ||\-)',''); + for j = 1:numel(header) + o.results.(savedoutput{i}).(header{j}) = dseries(data(:,j+1), o.y.init, header(j)); + end + elseif lower(savedoutput{i}) == 'rrs' + o.results.(savedoutput{i}) = dseries(data(:,2), o.y.init, savedoutput{i}); + elseif lower(savedoutput{i}) == 'rsd' + o.results.(savedoutput{i}) = dseries(data(:,2), o.y.init, savedoutput{i}); + elseif lower(savedoutput{i}) == 'rcm' + o.results.(savedoutput{i}) = fileread(sprintf('%s.rcm', basename)); + elseif lower(savedoutput{i}) == 'acm' + o.results.(savedoutput{i}) = fileread(sprintf('%s.acm', basename)); + elseif lower(savedoutput{i}) == 'rts' + header = strjoin(tmp.textdata(1,1)); + header = strsplit(header, {'\t'}); + info = tmp.textdata(3:end,1:2); + for j = 1:rows(data) + for k = 1:columns(info) + o.results.(savedoutput{i}).(['root_' num2str(j)]).(header{k}) = strjoin(info(j,k)); + end + for k = 1:columns(data) + o.results.(savedoutput{i}).(['root_' num2str(j)]).(header{k+columns(info)}) = data(j,k); + end + end + elseif lower(savedoutput{i}) == 'itr' + data = data(:,3:end); + header = strjoin(tmp.textdata(1,1)); + header = strsplit(header, {'\t'}); + header = header(3:end-1); + for j = 1:rows(data) + for k = 1:columns(header) + o.results.(savedoutput{i}).(['iter_' num2str(j)]).(header{k}) = data(j,k); + end + end + elseif lower(savedoutput{i}) == 'mdl' + o.results.(savedoutput{i}) = fileread(sprintf('%s.mdl', basename)); + end + end + end + end +end + +% Save results related to the HISTORY command +if ~all(cellfun(@isempty, struct2cell(o.history))) + if ~isempty(o.history.save) + savedoutput = strsplit(o.history.save, {',' , '(' , ')' , ' '}); + savedoutput = savedoutput(~cellfun('isempty', savedoutput)); + for i=1:length(savedoutput) + if exist(sprintf('%s.%s', basename, lower(savedoutput{i}))) + % Prov + o.results.(savedoutput{i}) =fileread(sprintf('%s.%s', basename,lower(savedoutput{i}))); + end + end + end +end + % Save main generated output file. o.results.out = fileread(sprintf('%s.out', basename)); \ No newline at end of file diff --git a/src/@x13/subsasgn.m b/src/@x13/subsasgn.m index 33353b31a3d2c32270306c0a0ec9b355687250b4..3fe9956ed303eba330cdd6a81fc9e9b25eeb3f08 100644 --- a/src/@x13/subsasgn.m +++ b/src/@x13/subsasgn.m @@ -1,4 +1,4 @@ -function val = subsasgn(val, idx, rhs) % --*-- Unitary tests --*-- +function val = subsasgn(val, idx, rhs) % Copyright (C) 2017 Dynare Team % diff --git a/src/@x13/subsref.m b/src/@x13/subsref.m index e26223940b0d5fb14964e1caccba056c33fca0c2..df687ff1b06b5bfa7f8c5231e028de1827a79c88 100644 --- a/src/@x13/subsref.m +++ b/src/@x13/subsref.m @@ -1,17 +1,15 @@ -function o = subsref(o, S) % --*-- Unitary tests --*-- +function o = subsref(o, S) % Overloads the subsref method. % Copyright (C) 2017 Dynare Team % -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify +% This code 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, +% Dynare dseries submodule 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. @@ -22,24 +20,24 @@ function o = subsref(o, S) % --*-- Unitary tests --*-- switch S(1).type case '.' switch S(1).subs - case {'arima','automdl','regression','transform','outlier', 'forecast', 'check', 'x11', 'estimate'} + case {'x','y'} + if isequal(length(S), 1) + o = builtin('subsref', o, S(1)); + else + if isequal(S(2).type,'.') + o = builtin('subsref', o.(S(1).subs), S(2)); + end + end + case {'commands'} + o = builtin('subsref', o, S(1)); + case {'arima','automdl','regression','transform','outlier', 'forecast', 'check', 'x11', 'estimate','composite',... + 'force','history','metadata','identify','pickmdl','seats','slidingspans','spectrum','x11regression'} if isequal(length(S), 1) - % Just print the member. - disp(o.(S(1).subs)) + o = builtin('subsref', o, S(1)); else if isequal(S(2).type,'()') if ~ismember(S(1).subs, o.commands) - switch S(1).subs - case 'arima' - if ismember('automdl', o.commands) - error('x13:arima: ARIMA command is not compatible with AUTOMDL command!') - end - case 'automdl' - if ismember('arima', o.commands) - error('x13:automdl: AUTOMDL command is not compatible with ARIMA command!') - end - otherwise - end + checkcommandcompatibility(o, S(1).subs); o.commands(end+1) = {S(1).subs}; end if isempty(S(2).subs) @@ -53,11 +51,14 @@ switch S(1).type for i=1:2:length(S(2).subs) if isoption(S(1).subs, S(2).subs{i}) o.(S(1).subs) = setoption(o.(S(1).subs), S(2).subs{i}, S(2).subs{i+1}); + checkoptioncompatibility(o); else disp(sprintf('Option %s is not available in block %s!', S(2).subs{i}, S(1).subs)) end end end + elseif isequal(S(2).type,'.') + o = builtin('subsref', o.(S(1).subs), S(2)); else error('x13:%s: Wrong calling sequence!', S(1).subs) end @@ -80,7 +81,13 @@ switch S(1).type end case 'results' % Returns a structure with all the results. - o = o.results; + if isequal(length(S), 1) + o = builtin('subsref', o, S(1)); + else + if isequal(S(2).type,'.') + o = builtin('subsref', o.(S(1).subs), S(2)); + end + end otherwise error('x13:: I do not understand what you are asking for!') end diff --git a/src/@x13/x13.m b/src/@x13/x13.m index 2eeece9009bf8490bdaf20b7bd01c57be3d74d6b..98fc4422ebd83534532b3a85937cf25c554414b1 100644 --- a/src/@x13/x13.m +++ b/src/@x13/x13.m @@ -1,4 +1,4 @@ -classdef x13<handle % --*-- Unitary tests --*-- +classdef x13<handle % Class for X13 toolbox. @@ -18,30 +18,39 @@ classdef x13<handle % --*-- Unitary tests --*-- % along with Dynare. If not, see <http://www.gnu.org/licenses/>. properties - y = []; % dseries object with a single variable. - x = []; % dseries object with an arbitrary number of variables (to be used in the REGRESSION block). - arima = []; % ARIMA model. - automdl = []; % ARIMA model selection. - regression = []; % Regression model. - estimate = []; % Estimation options. - transform = []; % Transform command applied to y. - outlier = []; % Outlier command. - forecast = []; % Forecast command. - check = []; % Check command. - x11 = []; % X11 cmmand - results = []; % Estimation results - commands = {}; % List of commands. + y = []; % dseries object with a single variable. + x = []; % dseries object with an arbitrary number of variables (to be used in the REGRESSION block). + arima = []; % ARIMA model. + automdl = []; % ARIMA model selection. + regression = []; % Regression command, specification for including regression variables in a regARIMA model, or for specifying regression variables whose effects are to be removed by the identify spec to aid ARIMA model identification. + estimate = []; % Estimation command, estimates the regARIMA model specified with the regression and arima commands. + transform = []; % Transform command, transforms or adjusts the series prior to estimating a regARIMA model. + outlier = []; % Outlier command, performs automatic detection of additive (point) outliers, temporary change outliers, level shifts, or any combination of the three using the specified model. + forecast = []; % Forecast command, forecasts and/or backcasts the time series y using the estimated model. + check = []; % Check command, produces statistics for diagnostic checking of residuals from the estimated model. + x11 = []; % X11 command, invokes seasonal adjustment by an enhanced version of the methodology of the Census Bureau X-11 and X-11Q program. + force = []; % Force command, allow users to force yearly totals of the seasonally adjusted series to equal those of the original series for convenience. + history = []; % History command, requests a sequence of runs from a sequence of truncated versions of the time series. + metadata = []; % Metadata command, allows users to insert metadata into the diagnostic summary file. + identify = []; % Identify command, produces tables and line printer plots of sample ACFs and PACFs for identifying the ARIMA part of a regARIMA model. + pickmdl = []; % Pickmdl command, automatic model selection procedure for the ARIMA part of the regARIMA model. + seats = []; % Seats command, invokes the production of model based signal extraction using SEATS, a seasonal adjustment program developed by Victor Gomez and Agustin Maravall at the Bank of Spain. + slidingspans = []; % Slidingspans command, compares different features of seasonal adjustment output from overlapping subspans of the time series data. + spectrum = []; % Spectrum command, spectrum diagnostics to detect seasonality or trading day effects in monthly series. + x11regression = []; % X11Regression command, estimates calendar effects by regression modeling of the irregular component with predefined or user-defined regressors. + results = []; % Estimation results. + commands = {}; % List of commands. end methods - function o = x13(y, x) - % Constructor for the x13 class. - % - % INPUTS - % - y [dseries] Data. - % - % OUPUTS - % - o [x13] Empty object except for the data. + function o = x13(y, x) + % Constructor for the x13 class. + % + % INPUTS + % - y [dseries] Data. + % + % OUPUTS + % - o [x13] Empty object except for the data. if ~nargin o.y = dseries(); o.x = dseries(); @@ -54,6 +63,15 @@ methods o.forecast = setdefaultmember('forecast'); o.check = setdefaultmember('check'); o.x11 = setdefaultmember('x11'); + o.force = setdefaultmember('force'); + o.history = setdefaultmember('history'); + o.metadata = setdefaultmember('metadata'); + o.identify = setdefaultmember('identify'); + o.pickmdl = setdefaultmember('pickmdl'); + o.seats = setdefaultmember('seats'); + o.slidingspans = setdefaultmember('slidingspans'); + o.spectrum = setdefaultmember('spectrum'); + o.x11regression = setdefaultmember('x11regression'); o.results = struct(); o.commands = {}; return @@ -86,8 +104,18 @@ methods o.forecast = setdefaultmember('forecast'); o.check = setdefaultmember('check'); o.x11 = setdefaultmember('x11'); + o.force = setdefaultmember('force'); + o.history = setdefaultmember('history'); + o.metadata = setdefaultmember('metadata'); + o.identify = setdefaultmember('identify'); + o.pickmdl = setdefaultmember('pickmdl'); + o.seats = setdefaultmember('seats'); + o.slidingspans = setdefaultmember('slidingspans'); + o.spectrum = setdefaultmember('spectrum'); + o.x11regression = setdefaultmember('x11regression'); o.results = struct(); o.commands = {}; - end + end end + end \ No newline at end of file diff --git a/src/utilities/missing/one_sided_hp_filter/one_sided_hp_filter.m b/src/utilities/missing/one_sided_hp_filter/one_sided_hp_filter.m index 100dca04e2735d20fff5089eda6c3d97a6db3294..a0417405425fb1f71cb9026aad3106d7d43007d0 100644 --- a/src/utilities/missing/one_sided_hp_filter/one_sided_hp_filter.m +++ b/src/utilities/missing/one_sided_hp_filter/one_sided_hp_filter.m @@ -70,7 +70,7 @@ Q=[q,0; R=1; % variance observation equation error for k=1:n %Run the Kalman filter for each variable - if nargin < 4 || isempty(x_user) %no intial value for state, extrapolate back two periods from the observations + if nargin < 3 || isempty(x_user) %no intial value for state, extrapolate back two periods from the observations x=[2*y(1,k)-y(2,k); 3*y(1,k)-2*y(2,k)]; else diff --git a/src/utilities/x13/checkcommandcompatibility.m b/src/utilities/x13/checkcommandcompatibility.m new file mode 100644 index 0000000000000000000000000000000000000000..9359cddc821821ecb8e686c7c7f6261c8b53d183 --- /dev/null +++ b/src/utilities/x13/checkcommandcompatibility.m @@ -0,0 +1,40 @@ +function checkcommandcompatibility(o, comm) + +% Checks for compatibility of X13 commands. + +% Copyright (C) 2017 Dynare Team +% +% This code 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 dseries submodule 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/>. + +switch comm + case 'arima' + if ismember('automdl', o.commands) + error('x13:arima: ARIMA command is not compatible with AUTOMDL command!') + elseif ismember('pickmdl', o.commands) + error('x13:arima: ARIMA command is not compatible with PICKMDL command!') + end + case 'automdl' + if ismember('arima', o.commands) + error('x13:automdl: AUTOMDL command is not compatible with ARIMA command!') + elseif ismember('pickmdl', o.commands) + error('x13:automdl: AUTOMDL command is not compatible with PICKMDL command!') + end + case 'pickmdl' + if ismember('arima', o.commands) + error('x13:pickmdl: PICKMDL command is not compatible with ARIMA command!') + elseif ismember('automdl', o.commands) + error('x13:pickmdl: PICKMDL command is not compatible with AUTOMDL command!') + end + otherwise +end \ No newline at end of file diff --git a/src/utilities/x13/checkoptioncompatibility.m b/src/utilities/x13/checkoptioncompatibility.m new file mode 100644 index 0000000000000000000000000000000000000000..e405ae2ca26818c869db737c1a60dfa406e2ddb5 --- /dev/null +++ b/src/utilities/x13/checkoptioncompatibility.m @@ -0,0 +1,38 @@ +function checkoptioncompatibility(o) + +% Checks for compatibility of options in different X13 commands. + +% Copyright (C) 2017 Dynare Team +% +% This code 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 dseries submodule 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(o.estimate.file) + if ~isempty(o.arima.model) + error('Options ARIMA.model and ESTIMATE.file not compatible!'); + elseif ~isempty(o.arima.ar) + error('Options ARIMA.ar and ESTIMATE.file not compatible!'); + elseif ~isempty(o.arima.model) + error('Options ARIMA.ma and ESTIMATE.file not compatible!'); + elseif ~isempty(o.regression.user) + error('Options REGRESSION.user and ESTIMATE.file not compatible!'); + elseif ~isempty(o.regression.b) + error('Options REGRESSION.b and ESTIMATE.file not compatible!'); + elseif ~isempty(o.regression.variables) + error('Options REGRESSION.variables and ESTIMATE.file not compatible!'); + elseif ismember('automdl',o.commands) + error('Command AUTOMDL not compatible with ESTIMATE.file option!'); + elseif ismember('pickmdl',o.commands) + error('Command PICKMDL not compatible with ESTIMATE.file option!'); + end +end \ No newline at end of file diff --git a/src/utilities/x13/isoption.m b/src/utilities/x13/isoption.m index 258ce583e506a7fbd44d51b0aef4e88e6faf6942..e63d44ae121bdd20b4113283b10ae1a0bbf7ef53 100644 --- a/src/utilities/x13/isoption.m +++ b/src/utilities/x13/isoption.m @@ -45,6 +45,36 @@ switch command 'savelog', 'seasonalma', 'sigmalim', 'title', 'trendma', 'type', ... 'calendarsigma', 'centerseasonal', 'keepholiday', 'print1stpass', ... 'sfshort', 'sigmavec', 'trendic', 'true7term', 'excludefcst'}); + case 'force' + b = ismember(option, {'print', 'save', 'lambda', 'mode', 'rho', 'round', 'start', 'target', 'type', ... + 'usefcst', 'indforce'}); + case 'history' + b = ismember(option, {'print', 'save', 'endtable', 'estimates', 'fixmdl', 'fixreg', 'fstep', 'sadjlags', ... + 'savelog', 'start', 'target', 'trendlags', 'fixx11reg', 'outlier', 'outlierwin', ... + 'refresh', 'transformfcst', 'x11outlier'}); + case 'metadata' + b = ismember(option, {'keys', 'values'}); + case 'identify' + b = ismember(option, {'print', 'save', 'diff', 'maxlag', 'sdiff'}); + case 'pickmdl' + b = ismember(option, {'print', 'bcstlim', 'fcstlim', 'file', 'identify', 'method', 'mode', 'outofsample', ... + 'overdiff', 'qlim', 'savelog'}); + case 'seats' + b = ismember(option, {'print', 'save', 'appendfcst', 'finite', 'hpcycle', 'noadmiss', 'out', 'printphtrf', 'qmax', ... + 'savelog', 'statseas', 'tabtables', 'bias', 'epsiv', 'epsphi', 'hplan', 'imean', ... + 'maxit', 'rmod', 'xl'}); + case 'slidingspans' + b = ismember(option, {'print', 'save', 'cutchng', 'cutseas', 'cuttd', 'fixmdl', 'fixreg', 'length', 'numspans', ... + 'outlier', 'savelog', 'start', 'additivesa', 'fixx11reg', 'x11outlier'}); + case 'spectrum' + b = ismember(option, {'print', 'save', 'logqs', 'qcheck', 'savelog', 'start', 'tukey120', 'decibel', 'difference', ... + 'maxar', 'peaxwidth', 'series', 'siglevel', 'type'}); + case 'x11regression' + b = ismember(option, {'print', 'save', 'aicdiff', 'aictest', 'critical', 'data', 'file', 'format', 'outliermethod', ... + 'outlierspan', 'prior', 'savelog','sigma', 'span', 'start', 'tdprior', 'user', ... + 'usertype', 'variables', 'almost', 'b', 'centeruser', 'eastermeans', 'forcecal', ... + 'noapply', 'reweight', 'umdata', 'umfile', 'umformat', 'umname', 'umprecision', ... + 'umstart', 'umtrimzero'}); otherwise error('x13:isoption: Unknown block!') end diff --git a/src/utilities/x13/setdefaultmember.m b/src/utilities/x13/setdefaultmember.m index f75ddb05e012b228f6d298322d553e835627f44b..a266a0f698582c5787c4d440a9272a434d1db08d 100644 --- a/src/utilities/x13/setdefaultmember.m +++ b/src/utilities/x13/setdefaultmember.m @@ -1,6 +1,6 @@ function s = setdefaultmember(name) -% Set members of X13 object to default values (empty). +% Sets members of X13 object to default values (empty). % Copyright (C) 2017 Dynare Team % @@ -49,6 +49,36 @@ switch name 'savelog', [], 'seasonalma', [], 'sigmalim', [], 'title', [], 'trendma', [], 'type', [], ... 'calendarsigma', [], 'centerseasonal', [], 'keepholiday', [], 'print1stpass', [], ... 'sfshort', [], 'sigmavec', [], 'trendic', [], 'true7term', [], 'excludefcst', []); + case 'force' + s = struct('print', [], 'save', [], 'lambda', [], 'mode', [], 'rho', [], 'round', [], 'start', [], 'target', [], 'type', [], ... + 'usefcst', [], 'indforce', []); + case 'history' + s = struct('print', [], 'save', [], 'endtable', [], 'estimates', [], 'fixmdl', [], 'fixreg', [], 'fstep', [], 'sadjlags', [], ... + 'savelog', [], 'start', [], 'target', [], 'trendlags', [], 'fixx11reg', [], 'outlier', [], 'outlierwin', [], ... + 'refresh', [], 'transformfcst', [], 'x11outlier', []); + case 'metadata' + s = struct('keys', [], 'values', []); + case 'identify' + s = struct('print', [], 'save', [], 'diff', [], 'maxlag', [], 'sdiff', []); + case 'pickmdl' + s = struct('print', [], 'bcstlim', [], 'fcstlim', [], 'file', [], 'identify', [], 'method', [], 'mode', [], 'outofsample', [], ... + 'overdiff', [], 'qlim', [], 'savelog', []); + case 'seats' + s = struct('print', [], 'save', [], 'appendfcst', [], 'finite', [], 'hpcycle', [], 'noadmiss', [], 'out', [], 'printphtrf', [], 'qmax', [], ... + 'savelog', [], 'statseas', [], 'tabtables', [], 'bias', [], 'epsiv', [], 'epsphi', [], 'hplan', [], 'imean', [], ... + 'maxit', [], 'rmod', [], 'xl', []); + case 'slidingspans' + s = struct('print', [], 'save', [], 'cutchng', [], 'cutseas', [], 'cuttd', [], 'fixmdl', [], 'fixreg', [], 'length', [], 'numspans', [], ... + 'outlier', [], 'savelog', [], 'start', [], 'additivesa', [], 'fixx11reg', [], 'x11outlier', []); + case 'spectrum' + s = struct('print', [], 'save', [], 'logqs', [], 'qcheck', [], 'savelog', [], 'start', [], 'tukey120', [], 'decibel', [], 'difference', [], ... + 'maxar', [], 'peaxwidth', [], 'series', [], 'siglevel', [], 'type', []); + case 'x11regression' + s = struct('print', [], 'save', [], 'aicdiff', [], 'aictest', [], 'critical', [], 'data', [], 'file', [], 'format', [], 'outliermethod', [], ... + 'outlierspan', [], 'prior', [], 'savelog', [],'sigma', [], 'span', [], 'start', [], 'tdprior', [], 'user', [], ... + 'usertype', [], 'variables', [], 'almost', [], 'b', [], 'centeruser', [], 'eastermeans', [], 'forcecal', [], ... + 'noapply', [], 'reweight', [], 'umdata', [], 'umfile', [], 'umformat', [], 'umname', [], 'umprecision', [], ... + 'umstart', [], 'umtrimzero', []); otherwise error('x13:setdefaultmember: Unknown member!') end