Commit 0899a16d authored by Stéphane Adjemian's avatar Stéphane Adjemian

Fixed indentation.

parent 39f9434d
......@@ -17,7 +17,7 @@ classdef arima<handle % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
properties
properties
y = []; % dseries object with a single variable.
p = []; % Number of lags on the autoregressive part.
d = []; % Order of differenciation.
......@@ -36,9 +36,9 @@ classdef arima<handle % --*-- Unitary tests --*--
MA_std = []; % Seasonal component moving average parameters estimator std.
sigma = []; % Standard deviation of the schock.
estimation = []; % Structure gathering informations related to the estimation of the model.
end
end
methods
methods
function o = arima(y, model)
% Constructor for the arma class.
%
......@@ -151,7 +151,7 @@ classdef arima<handle % --*-- Unitary tests --*--
error('arima::WrongInputArguments', 'Two input argument are mandatory!')
end
end % arima
end % methods
end % methods
end % classdef
%@test:1
......
......@@ -219,6 +219,3 @@ end
%$
%$ T = all(t);
%@eof:1
......@@ -17,14 +17,14 @@ classdef dseries<handle % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
properties
properties
data = []; % Array of data (a column per variable, a row per observation)
name = {}; % Names of the variables.
tex = {}; % TeX names of the variables.
dates = dates(); % Dates associated to the observations.
end
end
methods
methods
function o = dseries(varargin)
% Constructor for the dseries class
%
......@@ -186,7 +186,7 @@ classdef dseries<handle % --*-- Unitary tests --*--
o.dates = init:init+(nobs(o)-1);
end
end % dseries
end % methods
end % methods
end % classdef
%@test:1
......
......@@ -50,37 +50,37 @@ switch nargin
end
function a = concatenate(b,c)
[n,message] = common_strings_in_cell_arrays(b.name, c.name);
if isempty(b)
[n,message] = common_strings_in_cell_arrays(b.name, c.name);
if isempty(b)
a = c;
return
end
if isempty(c)
end
if isempty(c)
a = b;
return
end
if n
end
if n
error(['dseries::horzcat: I cannot concatenate dseries objects with common variable names (' message ')!'])
end
if ~isequal(frequency(b),frequency(c))
end
if ~isequal(frequency(b),frequency(c))
error('dseries::horzcat: All time series objects must have common frequency!')
else
else
a = dseries();
end
d_nobs_flag = 0;
if ~isequal(nobs(b),nobs(c))
end
d_nobs_flag = 0;
if ~isequal(nobs(b),nobs(c))
d_nobs_flag = 1;
end
d_init_flag = 0;
if ~isequal(firstdate(b),firstdate(c))
end
d_init_flag = 0;
if ~isequal(firstdate(b),firstdate(c))
d_init_flag = 1;
end
a.name = vertcat(b.name,c.name);
a.tex = vertcat(b.tex,c.tex);
if ~( d_nobs_flag(1) || d_init_flag(1) )
end
a.name = vertcat(b.name,c.name);
a.tex = vertcat(b.tex,c.tex);
if ~( d_nobs_flag(1) || d_init_flag(1) )
a.data = [b.data,c.data];
a.dates = b.dates;
else
else
nobs_b = nobs(b);
nobs_c = nobs(c);
if firstdate(b)<=firstdate(c)
......@@ -114,7 +114,7 @@ function a = concatenate(b,c)
a.data = [b.data, c.data];
a.dates = sort(unique(hd));
end
end
%@test:1
%$ % Define a data set.
......
function o = hptrend_(o, lambda) % --*-- Unitary tests --*--
function o = hptrend(o, lambda) % --*-- Unitary tests --*--
% Extracts the trend component from a dseries object using Hodrick Prescott filter.
%
......
function o = lag(o, p) % --*-- Unitary tests --*--
function o = lag_(o, p) % --*-- Unitary tests --*--
% Returns a lagged time series
%
......
function o = qgrowth_(o) % --*-- Unitary tests --*--
function o = qgrowth(o) % --*-- Unitary tests --*--
% Computes quaterly growth rates.
%
......
function o = rename_(o, old, new) % --*-- Unitary tests --*--
function o = rename(o, old, new) % --*-- Unitary tests --*--
% Renames variables in a dseries object.
%
......
......@@ -46,29 +46,29 @@ elseif nargin>1
end
function d = vertcat_(b, c)
d = NaN;
if ~isequal(frequency(b), frequency(c))
d = NaN;
if ~isequal(frequency(b), frequency(c))
error('dseries::vertcat: Frequencies must be common!')
end
if ~isequal(vobs(b), vobs(c))
end
if ~isequal(vobs(b), vobs(c))
error('dseries::vertcat: Number of variables must be common!')
end
reorder_variables_in_c = false;
if ~isequal(b.name, c.name)
end
reorder_variables_in_c = false;
if ~isequal(b.name, c.name)
[t, idx] = ismember(b.name, c.name);
if all(t)
reorder_variables_in_c = true;
else
error('dseries::vertcat: Variables must be common!')
end
end
d = b;
if reorder_variables_in_c
end
d = b;
if reorder_variables_in_c
d.data = [b.data; c.data(:,idx)];
else
else
d.data = [b.data; c.data];
end
d.dates = [b.dates; c.dates];
end
d.dates = [b.dates; c.dates];
%@test:1
%$ % Define a data set.
......
......@@ -17,7 +17,7 @@ classdef x13<handle % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
properties
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.
......@@ -31,9 +31,9 @@ classdef x13<handle % --*-- Unitary tests --*--
x11 = []; % X11 cmmand
results = []; % Estimation results
commands = {}; % List of commands.
end
end
methods
methods
function o = x13(y, x)
% Constructor for the x13 class.
%
......@@ -89,5 +89,5 @@ classdef x13<handle % --*-- Unitary tests --*--
o.results = struct();
o.commands = {};
end
end
end
end
\ No newline at end of file
......@@ -376,52 +376,52 @@ else
end
function msg = get_error_message_0(msg)
if ~nargin
if ~nargin
msg = sprintf('Wrong syntax! The correct syntax is:\n\n');
else
else
msg = [msg, sprintf('The correct syntax is:\n\n')];
end
msg = [msg, sprintf(' from d1 to d2 do SOMETHING\n\n')];
msg = [msg, sprintf('where d1<d2 are dates objects, and SOMETHING is a recursive expression involving dseries objects.')];
end
msg = [msg, sprintf(' from d1 to d2 do SOMETHING\n\n')];
msg = [msg, sprintf('where d1<d2 are dates objects, and SOMETHING is a recursive expression involving dseries objects.')];
function index = extractindex(str)
index = regexpi(str,'\(t\)|\(t\-\d\)|\(t\+\d\)','match');
index = regexpi(str,'\(t\)|\(t\-\d\)|\(t\+\d\)','match');
function i = index2num(id)
if isequal('(t)',id)
if isequal('(t)',id)
i = 0;
return
end
if isequal('-',id(3))
end
if isequal('-',id(3))
i = - str2num(id(4:end-1));
else
else
i = str2num(id(4:end-1));
end
end
function id = num2index(i)
if isequal(i,0)
if isequal(i,0)
id = '(t)';
return
end
if i<0
end
if i<0
id = ['(t-' int2str(abs(i)) ')'];
else
else
id = ['(t+' int2str(i) ')'];
end
end
function i = isassignedvariable(var,expr)
idv = strfind(expr,var);
idq = strfind(expr,'=');
if ~isempty(idv)
idv = strfind(expr,var);
idq = strfind(expr,'=');
if ~isempty(idv)
if idv(1)<idq
i = 1;
return
end
end
i = 0;
end
i = 0;
%@test:1
%$ try
......
......@@ -107,4 +107,3 @@ end
%$ end
%$ T = all(t);
%@eof:3
......@@ -22,6 +22,3 @@ names = {};
for i=1:dim
names = vertcat(names, {['Variable_' int2str(i)]});
end
......@@ -47,10 +47,10 @@ list_of_variables = vertcat(list_of_variables, VariableName);
function b = isnotempty_cell(CellArray)
CellArrayDimension = size(CellArray);
b = NaN(CellArrayDimension);
for i=1:CellArrayDimension(1)
CellArrayDimension = size(CellArray);
b = NaN(CellArrayDimension);
for i=1:CellArrayDimension(1)
for j = 1:CellArrayDimension(2)
b(i,j) = ~isempty(CellArray{i,j});
end
end
end
This diff is collapsed.
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