Added AUTOMDL command.

TODO Handle the incompatibility of ARIMA and AUTOMDL commands in the same spc file.
parent 418e0e71
......@@ -115,6 +115,18 @@ if ~all(cellfun(@isempty, struct2cell(o.arima)))
fprintf(fid, '}\n\n');
end
% Write AUTOMDL block
if ~all(cellfun(@isempty, struct2cell(o.automdl)))
optionnames = fieldnames(o.automdl);
fprintf(fid, 'automdl {\n');
for i=1:length(optionnames)
if ~isempty(o.automdl.(optionnames{i}))
printoption(fid, optionnames{i}, o.automdl.(optionnames{i}));
end
end
fprintf(fid, '}\n\n');
end
% Write OUTLIER block
if ~all(cellfun(@isempty, struct2cell(o.outlier)))
optionnames = fieldnames(o.outlier);
......
......@@ -22,7 +22,7 @@ function o = subsref(o, S) % --*-- Unitary tests --*--
switch S(1).type
case '.'
switch S(1).subs
case {'arima','regression','transform','outlier', 'forecast', 'check', 'x11', 'estimate'}
case {'arima','automdl','regression','transform','outlier', 'forecast', 'check', 'x11', 'estimate'}
if isequal(length(S), 1)
% Just print the member.
disp(o.(S(1).subs))
......
......@@ -21,6 +21,7 @@ classdef x13<handle % --*-- Unitary tests --*--
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.
......@@ -44,6 +45,7 @@ classdef x13<handle % --*-- Unitary tests --*--
o.y = dseries();
o.x = dseries();
o.arima = setdefaultmember('arima');
o.automdl = setdefaultmember('automdl');
o.regression = setdefaultmember('regression');
o.estimate = setdefaultmember('estimate');
o.transform = setdefaultmember('transform');
......@@ -72,6 +74,7 @@ classdef x13<handle % --*-- Unitary tests --*--
end
% Initialize other members (they are empty initially and must be set by calling methods)
o.arima = setdefaultmember('arima');
o.automdl = setdefaultmember('automdl');
o.regression = setdefaultmember('regression');
o.estimate = setdefaultmember('estimate');
o.transform = setdefaultmember('transform');
......
......@@ -18,6 +18,10 @@ function b = isoption(command, option)
switch command
case 'arima'
b = ismember(option, {'ar', 'ma', 'model', 'print', 'save', 'title'});
case 'automdl'
b = ismember(option, {'acceptdefault', 'checkmu', 'diff', 'ljungboxlimit', 'maxdiff', 'maxorder', ...
'mixed', 'print', 'savelog', 'armalimit', 'balanced', 'exactdiff', 'fcstlim', ...
'hrinitial', 'reducecv', 'rejectfcst', 'urfinal'});
case 'regression'
b = ismember(option, {'aicdiff', 'aictest', 'chi2test', 'chi2testcv', ...
'print', 'save', 'pvaictest', 'savelog', 'start', ...
......
......@@ -20,6 +20,10 @@ function s = setdefaultmember(name)
switch name
case 'arima'
s = struct('ar', [], 'ma', [], 'model', [], 'print', [], 'save', [], 'title', []);
case 'automdl'
s = struct('acceptdefault', [], 'checkmu', [], 'diff', [], 'ljungboxlimit', [], 'maxdiff', [], 'maxorder', ...
'mixed', [], 'print', [], 'savelog', [], 'armalimit', [], 'balanced', [], 'exactdiff', [], 'fcstlim', [], ...
'hrinitial', [], 'reducecv', [], 'rejectfcst', [], 'urfinal', []);
case 'regression'
s = struct('aicdiff', [], 'aictest', [], 'chi2test', [], 'chi2testcv', [], ...
'print', [], 'save', [], 'pvaictest', [], 'savelog', [], 'start', [], ...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment