diff --git a/externals/x13/installx13.m b/externals/x13/installx13.m index 17d1c5cb3b2d43f43d3dbc3f9830347e6bb6d94f..90620a9c3eee180bb57713d8afceea57d196a327 100644 --- a/externals/x13/installx13.m +++ b/externals/x13/installx13.m @@ -17,7 +17,7 @@ function installx13() % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. - + if ~exist('x13.zip','file') if ( ~isoctave() && verLessThan('matlab', 'R2014b') ) websave('x13.zip', 'http://www.dynare.org/x13/x13.zip'); diff --git a/externals/x13/uninstallx13.m b/externals/x13/uninstallx13.m index 4057bdb1e4ae7cdd9719fe6b93d7fa1d14257397..03c38c42b4a30cc3ba55d705d67b1854be905ab5 100644 --- a/externals/x13/uninstallx13.m +++ b/externals/x13/uninstallx13.m @@ -17,7 +17,7 @@ function uninstallx13() % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. - + if exist('x13.zip','file') delete('x13.zip') end diff --git a/src/@arima/arima.m b/src/@arima/arima.m index 8136ba3832a7125d474e73c99806f345fc3c29aa..2f6dedce378e9edb980af802ad3f479c51b009a5 100644 --- a/src/@arima/arima.m +++ b/src/@arima/arima.m @@ -9,7 +9,7 @@ classdef arima<handle % --*-- Unitary tests --*-- % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. @@ -17,141 +17,141 @@ 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 - y = []; % dseries object with a single variable. - p = []; % Number of lags on the autoregressive part. - d = []; % Order of differenciation. - q = []; % Number of lags on the moving average part. - P = []; % Seasonal component autoregressive part number of lags. - D = []; % Seasonal component order of differenciation. - Q = []; % Seasonal component moving average part number of lags. - S = []; % Seasonal component period. - ar = []; % Autoregressive parameters. - ma = []; % Moving arverage parameters. - AR = []; % Seasonal component autoregressive parameters. - MA = []; % Seasonal component moving average parameters. - ar_std = []; % Autoregressive parameters estimator std. - ma_std = []; % Moving arverage parameters estimator std. - AR_std = []; % Seasonal component autoregressive parameters estimator std. - 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 +properties + y = []; % dseries object with a single variable. + p = []; % Number of lags on the autoregressive part. + d = []; % Order of differenciation. + q = []; % Number of lags on the moving average part. + P = []; % Seasonal component autoregressive part number of lags. + D = []; % Seasonal component order of differenciation. + Q = []; % Seasonal component moving average part number of lags. + S = []; % Seasonal component period. + ar = []; % Autoregressive parameters. + ma = []; % Moving arverage parameters. + AR = []; % Seasonal component autoregressive parameters. + MA = []; % Seasonal component moving average parameters. + ar_std = []; % Autoregressive parameters estimator std. + ma_std = []; % Moving arverage parameters estimator std. + AR_std = []; % Seasonal component autoregressive parameters estimator std. + 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 - methods +methods function o = arima(y, model) % Constructor for the arma class. - % - % INPUTS + % + % INPUTS % - y [dseries] Data. % - model [string] Specification of the model of the form '(p, d, q)(P,D,Q)S', See X-13ARIMA-SEATS manual. % - % OUPUTS + % OUPUTS % - o [arima] ARIMA model object. - nargin - switch nargin - case 0 - % Return empty object. - o.y = []; % dseries object with a single variable. - o.p = []; % Number of lags on the autoregressive part. - o.d = []; % Order of differenciation. - o.q = []; % Number of lags on the moving average part. - o.P = []; % Seasonal component autoregressive part number of lags. - o.D = []; % Seasonal component order of differenciation. - o.Q = []; % Seasonal component moving average part number of lags. - o.S = []; % Seasonal component period. - o.ar = []; % Autoregressive parameters. - o.ma = []; % Moving arverage parameters. - o.AR = []; % Seasonal component autoregressive parameters. - o.MA = []; % Seasonal component moving average parameters. - o.ar_std = []; % Autoregressive parameters estimator std. - o.ma_std = []; % Moving arverage parameters estimator std. - o.AR_std = []; % Seasonal component autoregressive parameters estimator std. - o.MA_std = []; % Seasonal component moving average parameters estimator std. - o.sigma = []; % Standard deviation of the schock. - o.estimation = []; % Structure gathering informations related to the estimation of the model. - return - case 2 - if ~isdseries(y) - error('arima::WrongInputArguments', 'First input argument must be a dseries object!') - end - if ~ischar(model) - error('arima::WrongInputArguments', 'Second input argument must be a string!') + nargin + switch nargin + case 0 + % Return empty object. + o.y = []; % dseries object with a single variable. + o.p = []; % Number of lags on the autoregressive part. + o.d = []; % Order of differenciation. + o.q = []; % Number of lags on the moving average part. + o.P = []; % Seasonal component autoregressive part number of lags. + o.D = []; % Seasonal component order of differenciation. + o.Q = []; % Seasonal component moving average part number of lags. + o.S = []; % Seasonal component period. + o.ar = []; % Autoregressive parameters. + o.ma = []; % Moving arverage parameters. + o.AR = []; % Seasonal component autoregressive parameters. + o.MA = []; % Seasonal component moving average parameters. + o.ar_std = []; % Autoregressive parameters estimator std. + o.ma_std = []; % Moving arverage parameters estimator std. + o.AR_std = []; % Seasonal component autoregressive parameters estimator std. + o.MA_std = []; % Seasonal component moving average parameters estimator std. + o.sigma = []; % Standard deviation of the schock. + o.estimation = []; % Structure gathering informations related to the estimation of the model. + return + case 2 + if ~isdseries(y) + error('arima::WrongInputArguments', 'First input argument must be a dseries object!') + end + if ~ischar(model) + error('arima::WrongInputArguments', 'Second input argument must be a string!') + end + o.y = y; + o.estimation = struct(); + % Read the description of the ARIMA model. + model = regexprep(model,'(\s)',''); % Removes all spaces. + description = regexp(model, '(\([0-9],[0-9],[0-9]\)([0-9]+)?)', 'tokens'); + % First cell is the non seasonal component. + ns_arima = description{1}{1}; + ns_arima_specification = regexp(ns_arima, '([0-9]*)', 'tokens'); + o.p = str2num(ns_arima_specification{1}{1}); + o.d = str2num(ns_arima_specification{2}{1}); + o.q = str2num(ns_arima_specification{3}{1}); + % Set default values for parameters and estimate std. + if o.p + o.ar = zeros(o.p, 1); + o.ar_std = zeros(o.p, 1); + else + o.ar = []; + o.ar_std = []; + end + if o.q + o.ma = zeros(o.q, 1); + o.ma_std = zeros(o.q, 1); + else + o.ma = []; + o.ma_std = []; + end + % Following cells are the ARIMA models on the seasonal components. + number_of_seasonal_components = length(description)-1; + if number_of_seasonal_components + o.P = zeros(number_of_seasonal_components, 1); + o.D = zeros(number_of_seasonal_components, 1); + o.Q = zeros(number_of_seasonal_components, 1); + o.S = zeros(number_of_seasonal_components, 1); + for i=1:number_of_seasonal_components + s_arima = description{i+1}{1}; + s_arima_specification = regexp(s_arima, '([0-9]*)', 'tokens'); + if isequal(i, 1) && isequal(length(s_arima_specification), 3) + o.S(i) = y.init.freq; + else + o.S(i) = str2num(s_arima_specification{4}{1}); + end + o.P(i) = str2num(s_arima_specification{1}{1}); + o.D(i) = str2num(s_arima_specification{2}{1}); + o.Q(i) = str2num(s_arima_specification{3}{1}); end - o.y = y; - o.estimation = struct(); - % Read the description of the ARIMA model. - model = regexprep(model,'(\s)',''); % Removes all spaces. - description = regexp(model, '(\([0-9],[0-9],[0-9]\)([0-9]+)?)', 'tokens'); - % First cell is the non seasonal component. - ns_arima = description{1}{1}; - ns_arima_specification = regexp(ns_arima, '([0-9]*)', 'tokens'); - o.p = str2num(ns_arima_specification{1}{1}); - o.d = str2num(ns_arima_specification{2}{1}); - o.q = str2num(ns_arima_specification{3}{1}); - % Set default values for parameters and estimate std. - if o.p - o.ar = zeros(o.p, 1); - o.ar_std = zeros(o.p, 1); + end + % Set default values for parameters and estimate std. + o.AR = {}; + o.MA = {}; + o.AR_std = {}; + o.MA_std = {}; + for i=1:number_of_seasonal_components + if o.P(i) + o.AR{i} = zeros(o.P(i), 1); + o.AR_std{i} = zeros(o.P(i), 1); else - o.ar = []; - o.ar_std = []; + o.AR{i} = []; + o.AR_std{i} = []; end - if o.q - o.ma = zeros(o.q, 1); - o.ma_std = zeros(o.q, 1); + if o.Q(i) + o.MA{i} = zeros(o.Q(i), 1); + o.MA_std{i} = zeros(o.Q(i), 1); else - o.ma = []; - o.ma_std = []; - end - % Following cells are the ARIMA models on the seasonal components. - number_of_seasonal_components = length(description)-1; - if number_of_seasonal_components - o.P = zeros(number_of_seasonal_components, 1); - o.D = zeros(number_of_seasonal_components, 1); - o.Q = zeros(number_of_seasonal_components, 1); - o.S = zeros(number_of_seasonal_components, 1); - for i=1:number_of_seasonal_components - s_arima = description{i+1}{1}; - s_arima_specification = regexp(s_arima, '([0-9]*)', 'tokens'); - if isequal(i, 1) && isequal(length(s_arima_specification), 3) - o.S(i) = y.init.freq; - else - o.S(i) = str2num(s_arima_specification{4}{1}); - end - o.P(i) = str2num(s_arima_specification{1}{1}); - o.D(i) = str2num(s_arima_specification{2}{1}); - o.Q(i) = str2num(s_arima_specification{3}{1}); - end - end - % Set default values for parameters and estimate std. - o.AR = {}; - o.MA = {}; - o.AR_std = {}; - o.MA_std = {}; - for i=1:number_of_seasonal_components - if o.P(i) - o.AR{i} = zeros(o.P(i), 1); - o.AR_std{i} = zeros(o.P(i), 1); - else - o.AR{i} = []; - o.AR_std{i} = []; - end - if o.Q(i) - o.MA{i} = zeros(o.Q(i), 1); - o.MA_std{i} = zeros(o.Q(i), 1); - else - o.MA{i} = []; - o.MA_std{i} = []; - end + o.MA{i} = []; + o.MA_std{i} = []; end - % Set default value for the size of the innovation. - o.sigma = std(y.data); - otherwise - error('arima::WrongInputArguments', 'Two input argument are mandatory!') end + % Set default value for the size of the innovation. + o.sigma = std(y.data); + otherwise + error('arima::WrongInputArguments', 'Two input argument are mandatory!') + end end % arima - end % methods +end % methods end % classdef %@test:1 @@ -162,6 +162,6 @@ end % classdef %$ catch %$ t(1) = false; %$ end -%$ +%$ %$ T = all(t); %@eof:1 diff --git a/src/@arima/estimate.m b/src/@arima/estimate.m index ae9855a72e292b4ad9113b9c1a8bee458f568b0a..4826aba97c5347ac84748e7ba829286d55601fdc 100644 --- a/src/@arima/estimate.m +++ b/src/@arima/estimate.m @@ -9,7 +9,7 @@ function estimate(o, varargin) % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. @@ -219,6 +219,3 @@ end %$ %$ T = all(t); %@eof:1 - - - diff --git a/src/@dseries/abs.m b/src/@dseries/abs.m index b4def71a9e8a420a8b4ae6da21ea5a682a7aff2d..adf14b28e8829e01eb5a18011f3f100b0acc4db4 100644 --- a/src/@dseries/abs.m +++ b/src/@dseries/abs.m @@ -2,10 +2,10 @@ function o = abs(o) % --*-- Unitary tests --*-- % Apply the absolute value to all the variables in a dseries object (without in place modification). % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2011-2017 Dynare Team @@ -41,7 +41,7 @@ o.abs_; %$ catch %$ t(1) = false; %$ end -%$ +%$ %$ if t(1) %$ t(2) = dassert(o, q); %$ t(3) = dassert(p.data, ones(10, 2)); @@ -63,7 +63,7 @@ o.abs_; %$ catch %$ t(1) = false; %$ end -%$ +%$ %$ if t(1) %$ t(2) = dassert(length(p.name), 2); %$ t(3) = dassert(p.name{1},'abs(Variable_1)'); diff --git a/src/@dseries/abs_.m b/src/@dseries/abs_.m index a4d0378aecf6a75223ead9bf0eb80bf88937e901..2fed2c50641e006b7e5d8c889e9f8b6f7149fa44 100644 --- a/src/@dseries/abs_.m +++ b/src/@dseries/abs_.m @@ -2,10 +2,10 @@ function o = abs_(o) % --*-- Unitary tests --*-- % Apply the absolute value to all the variables in a dseries object (in place modification). % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2017 Dynare Team @@ -70,7 +70,7 @@ o.data = abs(o.data); %$ catch %$ t(1) = false; %$ end -%$ +%$ %$ if t(1) %$ t(2) = dassert(length(o.name), 2); %$ t(3) = dassert(o.name{1},'abs(Variable_1)'); diff --git a/src/@dseries/align.m b/src/@dseries/align.m index 228dec96471716af041582a96aea2f0555fdfcc6..d17db6d68a6ea3d36a9c8b195c880c019d76ae53 100644 --- a/src/@dseries/align.m +++ b/src/@dseries/align.m @@ -1,17 +1,17 @@ function [o, p] = align(o, p) % --*-- Unitary tests --*-- % If necessay completes dseries object o and p so that they are defined on the same time range -% (in place modification). -% -% INPUTS +% (in place modification). +% +% INPUTS % - o [dseries] % - p [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % - p [dseries] -% Copyright (C) 2013-2016 Dynare Team +% Copyright (C) 2013-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/@dseries/align_.m b/src/@dseries/align_.m index d3c72f86f626ca99b0b125051b55867de4b6594a..07f175766cc4236763eae51f82d77eea1fe5c0d1 100644 --- a/src/@dseries/align_.m +++ b/src/@dseries/align_.m @@ -1,17 +1,17 @@ function [o, p] = align_(o, p) % --*-- Unitary tests --*-- - + % If necessay completes dseries object o and p so that they are defined on the same time range -% (in place modification). -% -% INPUTS +% (in place modification). +% +% INPUTS % - o [dseries] % - p [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % - p [dseries] -% Copyright (C) 2013-2016 Dynare Team +% Copyright (C) 2013-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/@dseries/baxter_king_filter.m b/src/@dseries/baxter_king_filter.m index be6b2585b9f972a6aa239c79fa9d4236a4a52308..84c2b898ab62e833914c17bc0c2963bd8012b6a9 100644 --- a/src/@dseries/baxter_king_filter.m +++ b/src/@dseries/baxter_king_filter.m @@ -1,20 +1,20 @@ function o = baxter_king_filter(o, high_frequency, low_frequency, K) % --*-- Unitary tests --*-- % Implementation of Baxter and King (1999) band pass filter for dseries objects. The code is adapted from -% the one provided by Baxter and King. This filter isolates business cycle fluctuations with a period of length +% the one provided by Baxter and King. This filter isolates business cycle fluctuations with a period of length % ranging between high_frequency to low_frequency (quarters). % -% INPUTS +% INPUTS % - o dseries object. % - high_frequency positive scalar, period length (default value is 6). % - low_frequency positive scalar, period length (default value is 32). % - K positive scalar integer, truncation parameter (default value is 12). % -% OUTPUTS +% OUTPUTS % - o dseries object. % -% REMARKS -% This filter use a (symmetric) moving average smoother, so that K observations at the beginning and at the end of the +% REMARKS +% This filter use a (symmetric) moving average smoother, so that K observations at the beginning and at the end of the % sample are lost in the computation of the filter. % Copyright (C) 2013-2017 Dynare Team @@ -65,7 +65,7 @@ o.baxter_king_filter_(high_frequency, low_frequency, K); %$ % Create a dataset. %$ e = .2*randn(200,1); %$ u = randn(200,1); -%$ stochastic_trend = cumsum(e); +%$ stochastic_trend = cumsum(e); %$ deterministic_trend = .1*transpose(1:200); %$ x = zeros(200,1); %$ for i=2:200 diff --git a/src/@dseries/baxter_king_filter_.m b/src/@dseries/baxter_king_filter_.m index 31dac71b4e83b52612703d5a8c2e7504d9d36767..550bd00fe063722f87c87fcc4b93a3f528e6ead6 100644 --- a/src/@dseries/baxter_king_filter_.m +++ b/src/@dseries/baxter_king_filter_.m @@ -1,20 +1,20 @@ function o = baxter_king_filter_(o, high_frequency, low_frequency, K) % --*-- Unitary tests --*-- % Implementation of Baxter and King (1999) band pass filter for dseries objects. The code is adapted from -% the one provided by Baxter and King. This filter isolates business cycle fluctuations with a period of length +% the one provided by Baxter and King. This filter isolates business cycle fluctuations with a period of length % ranging between high_frequency to low_frequency (quarters). % -% INPUTS +% INPUTS % - o dseries object. % - high_frequency positive scalar, period length (default value is 6). % - low_frequency positive scalar, period length (default value is 32). % - K positive scalar integer, truncation parameter (default value is 12). % -% OUTPUTS +% OUTPUTS % - o dseries object. % -% REMARKS -% This filter use a (symmetric) moving average smoother, so that K observations at the beginning and at the end of the +% REMARKS +% This filter use a (symmetric) moving average smoother, so that K observations at the beginning and at the end of the % sample are lost in the computation of the filter. % Copyright (C) 2013-2017 Dynare Team @@ -55,7 +55,7 @@ if nargin<4 || isempty(K) end end end - + % translate periods into frequencies. hf=2.0*pi/high_frequency; lf=2.0*pi/low_frequency; @@ -86,7 +86,7 @@ tmp = zeros(size(o.data)); % Filtering step. for t = K+1:nobs(o)-K - tmp(t,:) = weights'*o.data(t-K:t+K,:); + tmp(t,:) = weights'*o.data(t-K:t+K,:); end % Update dseries object. @@ -105,7 +105,7 @@ end %$ % Create a dataset. %$ e = .2*randn(200,1); %$ u = randn(200,1); -%$ stochastic_trend = cumsum(e); +%$ stochastic_trend = cumsum(e); %$ deterministic_trend = .1*transpose(1:200); %$ x = zeros(200,1); %$ for i=2:200 diff --git a/src/@dseries/center.m b/src/@dseries/center.m index d351745b9d22052d2e41311b326a09e74374bd80..8baa3387f86ea9daad39f571b2e970ee503cf70a 100644 --- a/src/@dseries/center.m +++ b/src/@dseries/center.m @@ -2,11 +2,11 @@ function o = center(o, geometric) % --*-- Unitary tests --*-- % Centers dseries object o around its mean (arithmetic or geometric). % -% INPUTS +% INPUTS % - o dseries object [mandatory]. % - geometric logical [default is false], if true returns the geometric mean. % -% OUTPUTS +% OUTPUTS % - o dseries object. % Copyright (C) 2016-2017 Dynare Team diff --git a/src/@dseries/center_.m b/src/@dseries/center_.m index 90ec0eec2943925b19e3b659c2a6956a327720ef..5c14e6155d93d99d9aae397ad109267445c665b0 100644 --- a/src/@dseries/center_.m +++ b/src/@dseries/center_.m @@ -2,11 +2,11 @@ function o = center_(o, geometric) % --*-- Unitary tests --*-- % Centers dseries object o around its mean (arithmetic or geometric). % -% INPUTS +% INPUTS % - o dseries object [mandatory]. % - geometric logical [default is false], if true returns the geometric mean. % -% OUTPUTS +% OUTPUTS % - o dseries object. % Copyright (C) 2016-2017 Dynare Team diff --git a/src/@dseries/chain.m b/src/@dseries/chain.m index a0bc54a707970da403bbf168bb26a90e0963678d..6e05f6e748f89583993f1600e9f416ae95239f29 100644 --- a/src/@dseries/chain.m +++ b/src/@dseries/chain.m @@ -2,18 +2,18 @@ function q = chain(o, p) % --*-- Unitary tests --*-- % Chains two dseries objects. % -% INPUTS +% INPUTS % - o [dseries] % - p [dseries] % -% OUTPUTS +% OUTPUTS % - q [dseries] % -% REMARKS +% REMARKS % The two dseries objects must have common frequency and the same number of variables. Also the % two samples must overlap. -% Copyright (C) 2014 Dynare Team +% Copyright (C) 2014-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/@dseries/copy.m b/src/@dseries/copy.m index 8cd6fcc5a5d211f025785ee5cf0769ce2f089f58..af4a3f91fd02bec69fb2f321f2b6d4d3b77a6033 100644 --- a/src/@dseries/copy.m +++ b/src/@dseries/copy.m @@ -8,14 +8,14 @@ function p = copy(o) % --*-- Unitary tests --*-- % OUTPUTS % - p [dates] -% Copyright (C) 2015-2016 Dynare Team +% Copyright (C) 2015-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 dates submodule 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. @@ -27,7 +27,7 @@ p = dseries(); p.data = o.data; p.name = o.name; p.tex = o.tex; -p.dates = o.dates; +p.dates = o.dates; %@test:1 %$ % Define a dates object @@ -42,7 +42,7 @@ p.dates = o.dates; %$ catch %$ t(1) = false; %$ end -%$ +%$ %$ if t(1) %$ o.log_(); %$ t(2) = dassert(p, q); diff --git a/src/@dseries/cumprod_.m b/src/@dseries/cumprod_.m index 836090fa24dd8fcaa5ac67cc50f0ce56cca2e9d0..a9dd5207ce25976c7c230afbdfa4a1ab6788a245 100644 --- a/src/@dseries/cumprod_.m +++ b/src/@dseries/cumprod_.m @@ -49,23 +49,23 @@ end switch nargin case 1 - % Initialize the output. - o = varargin{1}; - % Perform the cumulated sum - if isequal(idx, 1) - o.data = cumprod(o.data); - else - if common_first_period_witout_nan - o.data(idx:end,:) = cumprod(o.data(idx:end,:)); - else - o.data = cumprodnan(o.data); - end - end - % Change the name of the variables - for i=1:vobs(o) - o.name(i) = {['cumprod(' o.name{i} ')']}; - o.tex(i) = {['\prod_t ' o.tex{i}]}; - end + % Initialize the output. + o = varargin{1}; + % Perform the cumulated sum + if isequal(idx, 1) + o.data = cumprod(o.data); + else + if common_first_period_witout_nan + o.data(idx:end,:) = cumprod(o.data(idx:end,:)); + else + o.data = cumprodnan(o.data); + end + end + % Change the name of the variables + for i=1:vobs(o) + o.name(i) = {['cumprod(' o.name{i} ')']}; + o.tex(i) = {['\prod_t ' o.tex{i}]}; + end case 2 if isdseries(varargin{2}) if ~isequal(vobs(varargin{1}), vobs(varargin{2})) diff --git a/src/@dseries/cumsum.m b/src/@dseries/cumsum.m index cb70b316e32e4e900300c5804a4d4b4accfce91e..cf80842582047b535d771a85d80162e2c40c956f 100644 --- a/src/@dseries/cumsum.m +++ b/src/@dseries/cumsum.m @@ -2,12 +2,12 @@ function o = cumsum(varargin) % --*-- Unitary tests --*-- % Overloads matlab's cumsum function for dseries objects. % -% INPUTS +% INPUTS % - o dseries object [mandatory]. % - d dates object [optional] % - v dseries object with one observation [optional] % -% OUTPUTS +% OUTPUTS % - o dseries object. % Copyright (C) 2013-2017 Dynare Team diff --git a/src/@dseries/cumsum_.m b/src/@dseries/cumsum_.m index a5e371a5682c2f860e44ed9c9380f94fb1caa2ee..39a0c804cb2593a8ae676525bb784a1924318bbd 100644 --- a/src/@dseries/cumsum_.m +++ b/src/@dseries/cumsum_.m @@ -2,12 +2,12 @@ function o = cumsum_(varargin) % --*-- Unitary tests --*-- % Overloads matlab's cumsum function for dseries objects. % -% INPUTS +% INPUTS % - o dseries object [mandatory]. % - d dates object [optional] % - v dseries object with one observation [optional] % -% OUTPUTS +% OUTPUTS % - o dseries object. % Copyright (C) 2013-2017 Dynare Team @@ -48,24 +48,24 @@ else end switch nargin - case 1 - % Initialize the output. - o = varargin{1}; - % Perform the cumulated sum - if isequal(idx, 1) - o.data = cumsum(o.data); - else - if common_first_period_witout_nan - o.data(idx:end,:) = cumsum(o.data(idx:end,:)); - else - o.data = cumsumnan(o.data); - end - end - % Change the name of the variables - for i=1:vobs(o) - o.name(i) = {['cumsum(' o.name{i} ')']}; - o.tex(i) = {['\sum_t ' o.tex{i}]}; - end + case 1 + % Initialize the output. + o = varargin{1}; + % Perform the cumulated sum + if isequal(idx, 1) + o.data = cumsum(o.data); + else + if common_first_period_witout_nan + o.data(idx:end,:) = cumsum(o.data(idx:end,:)); + else + o.data = cumsumnan(o.data); + end + end + % Change the name of the variables + for i=1:vobs(o) + o.name(i) = {['cumsum(' o.name{i} ')']}; + o.tex(i) = {['\sum_t ' o.tex{i}]}; + end case 2 if isdseries(varargin{2}) if ~isequal(vobs(varargin{1}), vobs(varargin{2})) diff --git a/src/@dseries/detrend.m b/src/@dseries/detrend.m index 34b04f80e5e79bf766443fac498927a0ab40fb1e..aae86370bf906291074aa94f5d62efdedaafcdf1 100644 --- a/src/@dseries/detrend.m +++ b/src/@dseries/detrend.m @@ -2,11 +2,11 @@ function o = detrend(o, model) % --*-- Unitary tests --*-- % Detrends a dseries object with a polynomial of order model. % -% INPUTS -% - o [dseries] time series to be detrended. +% INPUTS +% - o [dseries] time series to be detrended. % - model [integer] scalar, order of the fitted polynomial. % -% OUTPUTS +% OUTPUTS % - o [dseries] detrended time series. % Copyright (C) 2014-2017 Dynare Team diff --git a/src/@dseries/detrend_.m b/src/@dseries/detrend_.m index f6bc755eeec6cec946ea2e931400e9296db82fc9..137eb80dd08c71f9465e5a3c5f609ea887199475 100644 --- a/src/@dseries/detrend_.m +++ b/src/@dseries/detrend_.m @@ -2,11 +2,11 @@ function o = detrend_(o, model) % --*-- Unitary tests --*-- % Detrends a dseries object with a polynomial of order model. % -% INPUTS -% - o [dseries] time series to be detrended. +% INPUTS +% - o [dseries] time series to be detrended. % - model [integer] scalar, order of the fitted polynomial. % -% OUTPUTS +% OUTPUTS % - o [dseries] detrended time series. % Copyright (C) 2014-2017 Dynare Team diff --git a/src/@dseries/disp.m b/src/@dseries/disp.m index f4141f82308093afdf674612e1bbbd8f41d1eb51..6c458c9ceed99f72cae9d74777a03de5cee1e1c3 100644 --- a/src/@dseries/disp.m +++ b/src/@dseries/disp.m @@ -2,10 +2,10 @@ function disp(o) % Overloads disp method. % -% INPUTS +% INPUTS % - o [dseries] Object to be displayed. % -% OUTPUTS +% OUTPUTS % None % Copyright (C) 2011-2017 Dynare Team diff --git a/src/@dseries/display.m b/src/@dseries/display.m index bcb4093fdd08d85a3c80f2dfe5486883b8dcf051..896847769a92ffd68774ac99cc0ac322214e06c2 100644 --- a/src/@dseries/display.m +++ b/src/@dseries/display.m @@ -2,13 +2,13 @@ function display(o) % Overloads display method. % -% INPUTS +% INPUTS % - o [dseries] Object to be displayed. % -% OUTPUTS +% OUTPUTS % None % -% REMARKS +% REMARKS % Contray to the disp method, the whole dseries object is not displayed if the number of % observations is greater than 40 and if the number of variables is greater than 10. diff --git a/src/@dseries/dseries.m b/src/@dseries/dseries.m index 2ce00da3cdca39639017b05d23da36f172339897..5b6c23e1f8bac608c9317083553394e544e22683 100644 --- a/src/@dseries/dseries.m +++ b/src/@dseries/dseries.m @@ -2,14 +2,14 @@ classdef dseries<handle % --*-- Unitary tests --*-- % Class for time series. -% Copyright (C) 2013-2016 Dynare Team +% Copyright (C) 2013-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 dates submodule 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. @@ -17,25 +17,25 @@ 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 - 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 +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 - methods +methods function o = dseries(varargin) % Constructor for the dseries class - % - % INPUTS + % + % INPUTS % % - If no input arguments, the constructore returns an empty dseries object. % % - If only one input argument is provided, the behaviour of the constructor depends on the type of the argument: % + varargin{1} [dates] Constructor will return a dseries object without data. The dseries object can be populated later using dseries' methods. % + varargin{1} [char] The name of a csv, m, mat or xlsx file containing data. A dseries object is created from these data. - % + varargin{1} [double] A T*N array of data. A dseries object is created from the array (T observations, N variables). + % + varargin{1} [double] A T*N array of data. A dseries object is created from the array (T observations, N variables). % % - If only one two, three or four arguments are provided, we must have: % + varargin{1} [double] A T*N array of data. @@ -43,150 +43,150 @@ classdef dseries<handle % --*-- Unitary tests --*-- % + varargin{3} [cell] A N*1 cell of char or a N*q array of char, the names of the variables. % + varargin{4} [cell] A N*1 cell of char or a N*q array of char, the TeX names of the variables. % - % OUTPUTS + % OUTPUTS % - o [dseries] - switch nargin - case 0 - % Return empty object. - o.data = []; - o.name = {}; - o.tex = {}; - o.dates = dates(); - return - case 1 - if isdates(varargin{1}) - switch length(varargin{1}) - case 0 - error('dseries:WrongInputArguments', 'Input (identified as a dates object) must be non empty!'); - case 1 - % Create an empty dseries object with an initial date. - o.data = []; - o.name = {}; - o.tex = {}; - o.dates = varargin{1}; - otherwise - error('dseries:WrongInputArguments', 'Input (identified as a dates object) must have a unique element!'); - end - return - elseif ischar(varargin{1}) - [init, data, varlist, tex] = load_data(varargin{1}); - o.data = data; - o.name = varlist; - o.dates = init:init+(nobs(o)-1); - o.tex = tex; - elseif ~isoctave() && istable(varargin{1}) - % It is assumed that the dates are in the first column. - thistable = varargin{1}; - o.name = varargin{1}.Properties.VariableNames(2:end); - o.tex = name2tex(o.name); - o.data = varargin{1}{:,2:end}; - o.dates = dates(varargin{1}{1,1}{1})+(0:size(varargin{1}, 1)-1); - elseif isnumeric(varargin{1}) && isequal(ndims(varargin{1}),2) - o.data = varargin{1}; - o.name = default_name(vobs(o)); - o.tex = name2tex(o.name); - o.dates = dates(1,1):dates(1,1)+(nobs(o)-1); + switch nargin + case 0 + % Return empty object. + o.data = []; + o.name = {}; + o.tex = {}; + o.dates = dates(); + return + case 1 + if isdates(varargin{1}) + switch length(varargin{1}) + case 0 + error('dseries:WrongInputArguments', 'Input (identified as a dates object) must be non empty!'); + case 1 + % Create an empty dseries object with an initial date. + o.data = []; + o.name = {}; + o.tex = {}; + o.dates = varargin{1}; + otherwise + error('dseries:WrongInputArguments', 'Input (identified as a dates object) must have a unique element!'); end - case {2,3,4} - if isequal(nargin,2) && ischar(varargin{1}) && isdates(varargin{2}) - % Instantiate dseries object with a data file and force the initial date to - % be as given by the second input argument (initial period represented - % with a dates object). - [init, data, varlist, tex] = load_data(varargin{1}); - o.data = data; - o.name = varlist; - o.dates = varargin{2}:varargin{2}+(nobs(o)-1); - o.tex = tex; - return - end - if isequal(nargin,2) && ischar(varargin{1}) && ischar(varargin{2}) && isdate(varargin{2}) - % Instantiate dseries object with a data file and force the initial date to - % be as given by the second input argument (initial period represented with a - % string). - [init, data, varlist, tex] = load_data(varargin{1}); - o.data = data; - o.name = varlist; - o.dates = dates(varargin{2}):dates(varargin{2})+(nobs(o)-1); - o.tex = tex; - return + return + elseif ischar(varargin{1}) + [init, data, varlist, tex] = load_data(varargin{1}); + o.data = data; + o.name = varlist; + o.dates = init:init+(nobs(o)-1); + o.tex = tex; + elseif ~isoctave() && istable(varargin{1}) + % It is assumed that the dates are in the first column. + thistable = varargin{1}; + o.name = varargin{1}.Properties.VariableNames(2:end); + o.tex = name2tex(o.name); + o.data = varargin{1}{:,2:end}; + o.dates = dates(varargin{1}{1,1}{1})+(0:size(varargin{1}, 1)-1); + elseif isnumeric(varargin{1}) && isequal(ndims(varargin{1}),2) + o.data = varargin{1}; + o.name = default_name(vobs(o)); + o.tex = name2tex(o.name); + o.dates = dates(1,1):dates(1,1)+(nobs(o)-1); + end + case {2,3,4} + if isequal(nargin,2) && ischar(varargin{1}) && isdates(varargin{2}) + % Instantiate dseries object with a data file and force the initial date to + % be as given by the second input argument (initial period represented + % with a dates object). + [init, data, varlist, tex] = load_data(varargin{1}); + o.data = data; + o.name = varlist; + o.dates = varargin{2}:varargin{2}+(nobs(o)-1); + o.tex = tex; + return + end + if isequal(nargin,2) && ischar(varargin{1}) && ischar(varargin{2}) && isdate(varargin{2}) + % Instantiate dseries object with a data file and force the initial date to + % be as given by the second input argument (initial period represented with a + % string). + [init, data, varlist, tex] = load_data(varargin{1}); + o.data = data; + o.name = varlist; + o.dates = dates(varargin{2}):dates(varargin{2})+(nobs(o)-1); + o.tex = tex; + return + end + a = varargin{1}; + b = varargin{2}; + if nargin<4 + d = {}; + else + d = varargin{4}; + if ~iscell(d) && ~isempty(d) + d = cellstr(d); end - a = varargin{1}; - b = varargin{2}; - if nargin<4 - d = {}; - else - d = varargin{4}; - if ~iscell(d) && ~isempty(d) - d = cellstr(d); - end + end + if nargin<3 + c = {}; + else + c = varargin{3}; + if ~iscell(c) && ~isempty(c) + c = cellstr(c); end - if nargin<3 - c = {}; - else - c = varargin{3}; - if ~iscell(c) && ~isempty(c) - c = cellstr(c); - end + end + % Get data, number of observations and number of variables. + o.data = a; + % Get the first date and set the frequency. + if isempty(b) + init = dates(1,1); + elseif (isdates(b) && isequal(length(b),1)) + init = b; + elseif ischar(b) && isdate(b)% Weekly, Monthly, Quaterly or Annual data (string). + init = dates(b); + elseif (isnumeric(b) && isscalar(b) && isint(b)) % Yearly data. + init = dates([num2str(b) 'Y']); + elseif isdates(b) % Range of dates + init = b(1); + if nobs(o)>1 && ~isequal(b.ndat(),nobs(o)) + error('dseries:WrongInputArguments', ['If second input is a range, its number ' ... + 'of elements must match\nthe number of rows in the ' ... + 'first input, unless the first input\nhas only one row.']); + elseif isequal(nobs(o), 1) + o.data = repmat(o.data,b.ndat(),1); end - % Get data, number of observations and number of variables. - o.data = a; - % Get the first date and set the frequency. - if isempty(b) - init = dates(1,1); - elseif (isdates(b) && isequal(length(b),1)) - init = b; - elseif ischar(b) && isdate(b)% Weekly, Monthly, Quaterly or Annual data (string). - init = dates(b); - elseif (isnumeric(b) && isscalar(b) && isint(b)) % Yearly data. - init = dates([num2str(b) 'Y']); - elseif isdates(b) % Range of dates - init = b(1); - if nobs(o)>1 && ~isequal(b.ndat(),nobs(o)) - error('dseries:WrongInputArguments', ['If second input is a range, its number ' ... - 'of elements must match\nthe number of rows in the ' ... - 'first input, unless the first input\nhas only one row.']); - elseif isequal(nobs(o), 1) - o.data = repmat(o.data,b.ndat(),1); + o.dates = b; + elseif (isnumeric(b) && isint(b)) % Range of yearly dates. + error('dseries:WrongInputArguments', ['Not implemented! If you need to define ' ... + 'a range of years, you have to pass a dates object as the ' ... + 'second input argument']); + else + error('dseries:WrongInputArguments', 'Wrong calling sequence! Please check the manual.'); + end + % Get the names of the variables. + if ~isempty(c) + if vobs(o)==length(c) + for i=1:vobs(o) + o.name = vertcat(o.name, c(i)); end - o.dates = b; - elseif (isnumeric(b) && isint(b)) % Range of yearly dates. - error('dseries:WrongInputArguments', ['Not implemented! If you need to define ' ... - 'a range of years, you have to pass a dates object as the ' ... - 'second input argument']); else - error('dseries:WrongInputArguments', 'Wrong calling sequence! Please check the manual.'); + error('dseries:WrongInputArguments', 'The number of declared names does not match the number of variables!') end - % Get the names of the variables. - if ~isempty(c) - if vobs(o)==length(c) - for i=1:vobs(o) - o.name = vertcat(o.name, c(i)); - end - else - error('dseries:WrongInputArguments', 'The number of declared names does not match the number of variables!') + else + o.name = default_name(vobs(o)); + end + if ~isempty(d) + if vobs(o)==length(d) + for i=1:vobs(o) + o.tex = vertcat(o.tex, d(i)); end else - o.name = default_name(vobs(o)); + error('dseries:WrongInputArguments', 'The number of declared tex names does not match the number of variables!') end - if ~isempty(d) - if vobs(o)==length(d) - for i=1:vobs(o) - o.tex = vertcat(o.tex, d(i)); - end - else - error('dseries:WrongInputArguments', 'The number of declared tex names does not match the number of variables!') - end - else - o.tex = name2tex(o.name); - end - otherwise - error('dseries:WrongInputArguments', 'Wrong calling sequence! Please check the manual.') - end - if isempty(o.dates) - o.dates = init:init+(nobs(o)-1); + else + o.tex = name2tex(o.name); end + otherwise + error('dseries:WrongInputArguments', 'Wrong calling sequence! Please check the manual.') + end + if isempty(o.dates) + o.dates = init:init+(nobs(o)-1); + end end % dseries - end % methods +end % methods end % classdef %@test:1 diff --git a/src/@dseries/end.m b/src/@dseries/end.m index 1dc343c61d5818f654b357330f94cae12776fd09..4112658a423ab9a116bed8abc7f16d30c7031906 100644 --- a/src/@dseries/end.m +++ b/src/@dseries/end.m @@ -2,12 +2,12 @@ function lastIndex = end(o, k, n) % Overloads the end method. % -% INPUTS +% INPUTS % - o [dseries] % - k [integer] % - n [integer] % -% OUTPUTS +% OUTPUTS % - lastIndex [integer] % Copyright (C) 2014-2017 Dynare Team diff --git a/src/@dseries/eq.m b/src/@dseries/eq.m index 837bfb2ded86c4eff218b85d31800e6572d9050f..a7b77c3b4f52d3669bec9f15465e732477223b04 100644 --- a/src/@dseries/eq.m +++ b/src/@dseries/eq.m @@ -2,15 +2,15 @@ function b = eq(o, p) % --*-- Unitary tests --*-- % Overloads eq (==) operator. % -% INPUTS +% INPUTS % o A dseries object (T periods, N variables). % o B dseries object (T periods, N variables). % -% OUTPUTS -% o C T*N matrix of zeros and ones. Element C(t,n) is nonzero iff observation t of variable n in A and B are equal. +% OUTPUTS +% o C T*N matrix of zeros and ones. Element C(t,n) is nonzero iff observation t of variable n in A and B are equal. % -% REMARKS -% If the number of variables, the number of observations or the frequencies are different in A and B, the function returns a zero scalar. +% REMARKS +% If the number of variables, the number of observations or the frequencies are different in A and B, the function returns a zero scalar. % Copyright (C) 2013-2017 Dynare Team % diff --git a/src/@dseries/exist.m b/src/@dseries/exist.m index e4d5e387f0b9b925fbb8dc402cc6da8f38c48d70..9ccc794024cb7e49fe20dc400d9a50a16eb73620 100644 --- a/src/@dseries/exist.m +++ b/src/@dseries/exist.m @@ -2,14 +2,14 @@ function l = exist(o, varname) % --*-- Unitary tests --*-- % Tests if a variable exists in dseries object o. % -% INPUTS +% INPUTS % - o [dseries], dseries object. % - varname [string], name of a variable. % -% OUTPUTS -% - l [logical], equal to 1 (true) iff varname is a variable in dseries object o. +% OUTPUTS +% - l [logical], equal to 1 (true) iff varname is a variable in dseries object o. -% Copyright (C) 2014 Dynare Team +% Copyright (C) 2014-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/@dseries/exp.m b/src/@dseries/exp.m index 4caec49f4b79441450525a631171aa7cede8ad6d..25034f47ba0add424757cb4f39ce270fedf79b87 100644 --- a/src/@dseries/exp.m +++ b/src/@dseries/exp.m @@ -2,13 +2,13 @@ function o = exp(o) % --*-- Unitary tests --*-- % Apply the exponential to all the variables in a dseries object (without in place modification). % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] -% Copyright (C) 2011-2016 Dynare Team +% Copyright (C) 2011-2017 Dynare Team % % This file is part of Dynare. % @@ -41,7 +41,7 @@ o.exp_(); %$ catch %$ t(1) = false; %$ end -%$ +%$ %$ if t(1) %$ t(2) = dassert(o, q); %$ t(3) = dassert(p.data, ones(10, 2)); @@ -63,7 +63,7 @@ o.exp_(); %$ catch %$ t(1) = false; %$ end -%$ +%$ %$ if t(1) %$ t(2) = dassert(length(p.name), 2); %$ t(3) = dassert(p.name{1},'exp(Variable_1)'); diff --git a/src/@dseries/exp_.m b/src/@dseries/exp_.m index 1e6df4a0a82eb533d1fd383ae607f07e1d1af16a..47d761757636cf239bd3ca2cc3aba46338676066 100644 --- a/src/@dseries/exp_.m +++ b/src/@dseries/exp_.m @@ -2,13 +2,13 @@ function o = exp_(o) % --*-- Unitary tests --*-- % Apply the exponential to all the variables in a dseries object (in place modification). % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] -% Copyright (C) 2015-2016 Dynare Team +% Copyright (C) 2015-2017 Dynare Team % % This file is part of Dynare. % @@ -70,7 +70,7 @@ end %$ catch %$ t(1) = false; %$ end -%$ +%$ %$ if t(1) %$ t(2) = dassert(length(o.name), 2); %$ t(3) = dassert(o.name{1},'exp(Variable_1)'); diff --git a/src/@dseries/extract.m b/src/@dseries/extract.m index 640eeee29672022bccaae7b11eb2be4467480536..956b30413abf3d47abd6166005823f1fad9cbcc1 100644 --- a/src/@dseries/extract.m +++ b/src/@dseries/extract.m @@ -1,7 +1,7 @@ function p = extract(o, varargin) % --*-- Unitary tests --*-- % Extract some variables from a database. - + % Copyright (C) 2012-2017 Dynare Team % % This file is part of Dynare. @@ -67,8 +67,8 @@ p.data = o.data(:,idVariableName); p.dates = o.dates; p.name = o.name(idVariableName); p.tex = o.tex(idVariableName); - - + + %@test:1 %$ % Define a data set. %$ A = rand(10,24); diff --git a/src/@dseries/firstobservedperiod.m b/src/@dseries/firstobservedperiod.m index 8cee15d1955d347676ff1ba915bfe605eaf8aa85..0ba14448c11e9afde932ba0c5751174852c552ec 100644 --- a/src/@dseries/firstobservedperiod.m +++ b/src/@dseries/firstobservedperiod.m @@ -2,10 +2,10 @@ function d = firstobservedperiod(o) % --*-- Unitary tests --*-- % Returns the first period where all the variables are observed (first period without NaNs). % -% INPUTS +% INPUTS % - o [dseries] with N variables and T periods. % -% OUTPUTS +% OUTPUTS % - d [dates] First period where the N variables are observed (without NaNs). % Copyright (C) 2016-2017 Dynare Team diff --git a/src/@dseries/frequency.m b/src/@dseries/frequency.m index ba4950f21905da5b4f35e482fdb699f2945b4b24..8f12cc25f7702f7e4dd493bce97575c66cb1d7ec 100644 --- a/src/@dseries/frequency.m +++ b/src/@dseries/frequency.m @@ -2,10 +2,10 @@ function f = frequency(o) % Returns the frequency of a dseries object. % -% INPUTS +% INPUTS % - o [dseries] % -% OUPUTS +% OUPUTS % - f [integer] 1 (annual), 4 (quarterly), 12 (monthly) % Copyright (C) 2014-2017 Dynare Team diff --git a/src/@dseries/horzcat.m b/src/@dseries/horzcat.m index 7870be421b8c5f4aa531b4d2940a51a6a11bfc81..4471a19f44bcd19c9301f4a4b7a4cf456b854bc5 100644 --- a/src/@dseries/horzcat.m +++ b/src/@dseries/horzcat.m @@ -2,24 +2,24 @@ function o = horzcat(varargin) % --*-- Unitary tests --*-- % Overloads horzcat method for dseries objects. % -% INPUTS +% INPUTS % o o1 dseries object. % o o2 dseries object. % o ... % -% OUTPUTS +% OUTPUTS % o o dseries object. % -% EXAMPLE 1 +% EXAMPLE 1 % If o1, o2 and o3 are dseries objects the following syntax: -% +% % o = [o1, o2, o3] ; % % defines a dseries object o containing the variables appearing in o1, o2 and o3. % -% REMARKS +% REMARKS % o o1, o2, ... must not have common variables. - + % Copyright (C) 2011-2017 Dynare Team % % This file is part of Dynare. @@ -50,72 +50,72 @@ switch nargin end function a = concatenate(b,c) - [n,message] = common_strings_in_cell_arrays(b.name, c.name); - if isempty(b) - a = c; - return - end - if isempty(c) - a = b; - return - end - if n - error(['dseries::horzcat: I cannot concatenate dseries objects with common variable names (' message ')!']) - end - if ~isequal(frequency(b),frequency(c)) - error('dseries::horzcat: All time series objects must have common frequency!') +[n,message] = common_strings_in_cell_arrays(b.name, c.name); +if isempty(b) + a = c; + return +end +if isempty(c) + a = b; + return +end +if n + error(['dseries::horzcat: I cannot concatenate dseries objects with common variable names (' message ')!']) +end +if ~isequal(frequency(b),frequency(c)) + error('dseries::horzcat: All time series objects must have common frequency!') +else + a = dseries(); +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)) + 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 + nobs_b = nobs(b); + nobs_c = nobs(c); + if firstdate(b)<=firstdate(c) + if firstdate(b)<firstdate(c) + c.data = [NaN(firstdate(c)-firstdate(b), vobs(c)); c.data]; + end else - a = dseries(); - end - d_nobs_flag = 0; - if ~isequal(nobs(b),nobs(c)) - d_nobs_flag = 1; + b.data = [NaN(firstdate(b)-firstdate(c), vobs(b)); b.data]; end - d_init_flag = 0; - if ~isequal(firstdate(b),firstdate(c)) - d_init_flag = 1; + b_last_date = firstdate(b)+nobs_b; + c_last_date = firstdate(c)+nobs_c; + if b_last_date<c_last_date + b.data = [b.data; NaN(c_last_date-b_last_date, vobs(b))]; + elseif b_last_date>c_last_date + c.data = [c.data; NaN(b_last_date-c_last_date, vobs(c))]; 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 - nobs_b = nobs(b); - nobs_c = nobs(c); - if firstdate(b)<=firstdate(c) - if firstdate(b)<firstdate(c) - c.data = [NaN(firstdate(c)-firstdate(b), vobs(c)); c.data]; - end - else - b.data = [NaN(firstdate(b)-firstdate(c), vobs(b)); b.data]; - end - b_last_date = firstdate(b)+nobs_b; - c_last_date = firstdate(c)+nobs_c; - if b_last_date<c_last_date - b.data = [b.data; NaN(c_last_date-b_last_date, vobs(b))]; - elseif b_last_date>c_last_date - c.data = [c.data; NaN(b_last_date-c_last_date, vobs(c))]; - end - - fillerdates = dates(); - if max(c.dates) < min(b.dates) - fillerdates = max(c.dates):min(b.dates); - end - if max(b.dates) < min(c.dates) - fillerdates = max(b.dates):min(c.dates); - end - if isempty(fillerdates) - hd = [b.dates, c.dates]; - else - hd = [b.dates, fillerdates, c.dates]; - end + fillerdates = dates(); + if max(c.dates) < min(b.dates) + fillerdates = max(c.dates):min(b.dates); + end + if max(b.dates) < min(c.dates) + fillerdates = max(b.dates):min(c.dates); + end - a.data = [b.data, c.data]; - a.dates = sort(unique(hd)); + if isempty(fillerdates) + hd = [b.dates, c.dates]; + else + hd = [b.dates, fillerdates, c.dates]; end + a.data = [b.data, c.data]; + a.dates = sort(unique(hd)); +end + %@test:1 %$ % Define a data set. %$ A = [transpose(1:10),2*transpose(1:10)]; diff --git a/src/@dseries/hpcycle.m b/src/@dseries/hpcycle.m index 5461b0b1912d3329e8816cc00d781cb413bcc8b4..03b1785b165ed90a2295cb77d7bfb6f00b462dba 100644 --- a/src/@dseries/hpcycle.m +++ b/src/@dseries/hpcycle.m @@ -2,11 +2,11 @@ function o = hpcycle(o, lambda) % --*-- Unitary tests --*-- % Extracts the cycle component from a dseries object using Hodrick Prescott filter. % -% INPUTS +% INPUTS % - o [dseries] Original time series. % - lambda [double] scalar, trend smoothness parameter. % -% OUTPUTS +% OUTPUTS % - o [dseries] Cyclical component of the original time series. % Copyright (C) 2013-2017 Dynare Team @@ -26,7 +26,7 @@ function o = hpcycle(o, lambda) % --*-- 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/>. -if nargin>1 +if nargin>1 if lambda<=0 error(['dseries::hpcycle: Lambda must be a positive integer!']) end diff --git a/src/@dseries/hpcycle_.m b/src/@dseries/hpcycle_.m index 5437b0aea3ba150e906a18b2b1d80df89b62df35..4d46f7ef2adf1c8d1d5aa5b18fb5a507b07c5d64 100644 --- a/src/@dseries/hpcycle_.m +++ b/src/@dseries/hpcycle_.m @@ -2,11 +2,11 @@ function o = hpcycle_(o, lambda) % --*-- Unitary tests --*-- % Extracts the cycle component from a dseries object using Hodrick Prescott filter. % -% INPUTS +% INPUTS % - o [dseries] Original time series. % - lambda [double] scalar, trend smoothness parameter. % -% OUTPUTS +% OUTPUTS % - o [dseries] Cyclical component of the original time series. % Copyright (C) 2013-2017 Dynare Team @@ -26,7 +26,7 @@ function o = hpcycle_(o, lambda) % --*-- 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/>. -if nargin>1 +if nargin>1 if lambda<=0 error(['dseries::hpcycle: Lambda must be a positive integer!']) end @@ -48,7 +48,7 @@ o.data = data; %$ % Create a dataset. %$ e = .2*randn(200,1); %$ u = randn(200,1); -%$ stochastic_trend = cumsum(e); +%$ stochastic_trend = cumsum(e); %$ deterministic_trend = .1*transpose(1:200); %$ x = zeros(200,1); %$ for i=2:200 diff --git a/src/@dseries/hptrend.m b/src/@dseries/hptrend.m index bb07d5a33c8791b72b60e9871aacc7d987eeb5b8..84a39daa12c2f694b0da503a54e3e46fb7dbd8e0 100644 --- a/src/@dseries/hptrend.m +++ b/src/@dseries/hptrend.m @@ -1,12 +1,12 @@ -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. % -% INPUTS +% INPUTS % - o [dseries] Original time series. % - lambda [double] scalar, trend smoothness parameter. % -% OUTPUTS +% OUTPUTS % - o [dseries] Trend component of the original time series. % Copyright (C) 2013-2017 Dynare Team @@ -26,7 +26,7 @@ function o = hptrend_(o, lambda) % --*-- 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/>. -if nargin>1 +if nargin>1 if lambda<=0 error(['dseries::hptrend: Lambda must be a positive integer!']) end diff --git a/src/@dseries/hptrend_.m b/src/@dseries/hptrend_.m index 80742f18de3cd64517f8e76772adb9ab1231a17a..ee41f6060a859c8e17396139fc1e78f4d9ddebac 100644 --- a/src/@dseries/hptrend_.m +++ b/src/@dseries/hptrend_.m @@ -2,11 +2,11 @@ function o = hptrend_(o, lambda) % --*-- Unitary tests --*-- % Extracts the trend component from a dseries object using Hodrick Prescott filter. % -% INPUTS +% INPUTS % - o [dseries] Original time series. % - lambda [double] scalar, trend smoothness parameter. % -% OUTPUTS +% OUTPUTS % - o [dseries] Trend component of the original time series. % Copyright (C) 2013-2017 Dynare Team @@ -26,7 +26,7 @@ function o = hptrend_(o, lambda) % --*-- 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/>. -if nargin>1 +if nargin>1 if lambda<=0 error(['dseries::hptrend: Lambda must be a positive integer!']) end @@ -42,12 +42,12 @@ end o.data = sample_hp_filter(o.data, lambda); %@test:1 -%$ plot_flag = 0; +%$ plot_flag = 0; %$ %$ % Create a dataset. %$ e = .2*randn(200,1); %$ u = randn(200,1); -%$ stochastic_trend = cumsum(e); +%$ stochastic_trend = cumsum(e); %$ deterministic_trend = .1*transpose(1:200); %$ x = zeros(200,1); %$ for i=2:200 diff --git a/src/@dseries/insert.m b/src/@dseries/insert.m index b83b4a6ef1ef53c7aa2c4fd90eecd00452ee22fd..d809be7015b422a34cc49b1ac4fa73123c425eec 100644 --- a/src/@dseries/insert.m +++ b/src/@dseries/insert.m @@ -2,12 +2,12 @@ function o = insert(o, p, id) % --*-- Unitary tests --*-- % Adds a variable in a dseries object. % -% INPUTS +% INPUTS % - o [dseries] % - p [dseries] % - id [integer] vector of indices. % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2013-2017 Dynare Team @@ -45,10 +45,10 @@ p = copy(p); n = length(id); if n>1 - [id, jd] = sort(id); - p.data = p.data(:,jd); - p.name = p.name(jd); - p.tex = p.tex(jd); + [id, jd] = sort(id); + p.data = p.data(:,jd); + p.name = p.name(jd); + p.tex = p.tex(jd); end for i=1:n diff --git a/src/@dseries/isempty.m b/src/@dseries/isempty.m index f54f2c436d510e6a43d9b01c2c7660f431caab5d..c6b21558a8345c3fca783d89cd8d2429f84a334d 100644 --- a/src/@dseries/isempty.m +++ b/src/@dseries/isempty.m @@ -2,10 +2,10 @@ function b = isempty(o) % Overloads isempty method. % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - b [logical] % Copyright (C) 2011-2017 Dynare Team diff --git a/src/@dseries/isequal.m b/src/@dseries/isequal.m index e6bfc61b3a37fec32d51f1196034db8085b5df3f..586a1fdee7410e42e41b717ab666894c73e5d0f1 100644 --- a/src/@dseries/isequal.m +++ b/src/@dseries/isequal.m @@ -2,12 +2,12 @@ function b = isequal(o, p, tol) % Overloads the isequal Matlab/Octave's function. % -% INPUTS +% INPUTS % - o [dseries] T periods, N variables. % - p [dseries] T periods, N variables. % - tol [double] tolerance parameter. % -% OUTPUTS +% OUTPUTS % o b [logical] % Copyright (C) 2013-2017 Dynare Team diff --git a/src/@dseries/isnan.m b/src/@dseries/isnan.m index 4169415da2c4126dd02e6ac93d2a3970f56e5d1b..b6fd5ada59f9a0154e30c7c0aaaf58fbde8533aa 100644 --- a/src/@dseries/isnan.m +++ b/src/@dseries/isnan.m @@ -3,14 +3,14 @@ function b = isnan(o) % --*-- Unitary tests --*-- % Returns an array of logicals (true/false). Element (t,i) is true iff the i-th variable at % period number t is not a NaN. % -% INPUTS +% INPUTS % - o [dseries] with N variables and T periods. % -% OUTPUTS +% OUTPUTS % - b [logical] T*N array of logicals. -% Copyright (C) 2016 Dynare Team +% Copyright (C) 2016-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/@dseries/lag.m b/src/@dseries/lag.m index 8a02c9da532b5734b060d2e02de16d081972bea6..7ae5db73d21999aeead50cab7a10b84115f514ce 100644 --- a/src/@dseries/lag.m +++ b/src/@dseries/lag.m @@ -2,14 +2,14 @@ function o = lag(o, p) % --*-- Unitary tests --*-- % Returns a lagged time series % -% INPUTS +% INPUTS % - o [dseries] % - p [integer] Number of lags % -% OUTPUTS +% OUTPUTS % - o [dseries] % -% EXAMPLE +% EXAMPLE % Define a dseries object as follows: % % >> o = dseries(transpose(1:5)) @@ -17,13 +17,13 @@ function o = lag(o, p) % --*-- Unitary tests --*-- % then o.lag(1) returns % % | lag(Variable_1,1) -% 1Y | NaN -% 2Y | 1 -% 3Y | 2 -% 4Y | 3 -% 5Y | 4 +% 1Y | NaN +% 2Y | 1 +% 3Y | 2 +% 4Y | 3 +% 5Y | 4 -% Copyright (C) 2013-2016 Dynare Team +% Copyright (C) 2013-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/@dseries/lag_.m b/src/@dseries/lag_.m index d8925d865f9b5c1527969b725372e2c0b7697663..0cde0baa9181a2262358049d61bc9137030772eb 100644 --- a/src/@dseries/lag_.m +++ b/src/@dseries/lag_.m @@ -1,15 +1,15 @@ -function o = lag(o, p) % --*-- Unitary tests --*-- +function o = lag_(o, p) % --*-- Unitary tests --*-- % Returns a lagged time series % -% INPUTS +% INPUTS % - o [dseries] % - p [integer] Number of lags % -% OUTPUTS +% OUTPUTS % - o [dseries] % -% EXAMPLE +% EXAMPLE % Define a dseries object as follows: % % >> o = dseries(transpose(1:5)) @@ -17,13 +17,13 @@ function o = lag(o, p) % --*-- Unitary tests --*-- % then o.lag(1) returns % % | lag(Variable_1,1) -% 1Y | NaN -% 2Y | 1 -% 3Y | 2 -% 4Y | 3 -% 5Y | 4 +% 1Y | NaN +% 2Y | 1 +% 3Y | 2 +% 4Y | 3 +% 5Y | 4 -% Copyright (C) 2013-2016 Dynare Team +% Copyright (C) 2013-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/@dseries/lastdate.m b/src/@dseries/lastdate.m index 30f9bedc8ea12ae92697a0e112a1593aa49a9bc9..27f709a7993522708568f1270012c15f7b1332b7 100644 --- a/src/@dseries/lastdate.m +++ b/src/@dseries/lastdate.m @@ -2,10 +2,10 @@ function l = lastdate(o) % Returns last period of teh sample. % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - l [dates] % Copyright (C) 2014-2017 Dynare Team diff --git a/src/@dseries/lead.m b/src/@dseries/lead.m index 3ac0b0fe508fdb8da4d82a23b93aa7329cc34530..aea1b5be4378537647ad411a3198c5b87aa54e86 100644 --- a/src/@dseries/lead.m +++ b/src/@dseries/lead.m @@ -2,14 +2,14 @@ function o = lead(o, p) % --*-- Unitary tests --*-- % Returns a lagged time series % -% INPUTS +% INPUTS % - o [dseries] % - p [integer] Number of leads % -% OUTPUTS +% OUTPUTS % - o [dseries] % -% EXAMPLE +% EXAMPLE % Define a dseries object as follows: % % >> o = dseries(transpose(1:5)) @@ -17,11 +17,11 @@ function o = lead(o, p) % --*-- Unitary tests --*-- % then o.lag(1) returns % % | lead(Variable_1,1) -% 1Y | 2 -% 2Y | 3 -% 3Y | 4 -% 4Y | 5 -% 5Y | NaN +% 1Y | 2 +% 2Y | 3 +% 3Y | 4 +% 4Y | 5 +% 5Y | NaN % Copyright (C) 2013-2017 Dynare Team % diff --git a/src/@dseries/lead_.m b/src/@dseries/lead_.m index b9192e43371729d3dcb181c3cf0fc5c66d7f062f..52e1e8fff24624c5debe33fa5c4a42b03c4ae212 100644 --- a/src/@dseries/lead_.m +++ b/src/@dseries/lead_.m @@ -2,14 +2,14 @@ function o = lead_(o, p) % --*-- Unitary tests --*-- % Returns a leaded time series % -% INPUTS +% INPUTS % - o [dseries] % - p [integer] Number of leads % -% OUTPUTS +% OUTPUTS % - o [dseries] % -% EXAMPLE +% EXAMPLE % Define a dseries object as follows: % % >> o = dseries(transpose(1:5)) @@ -17,11 +17,11 @@ function o = lead_(o, p) % --*-- Unitary tests --*-- % then o.lag(1) returns % % | lead(Variable_1,1) -% 1Y | 2 -% 2Y | 3 -% 3Y | 4 -% 4Y | 5 -% 5Y | NaN +% 1Y | 2 +% 2Y | 3 +% 3Y | 4 +% 4Y | 5 +% 5Y | NaN % Copyright (C) 2013-2017 Dynare Team % diff --git a/src/@dseries/log.m b/src/@dseries/log.m index a2fdcb937a1a4e34415d760b7edd0fb97f28983a..34271fe520963f2ada33aaaa76167511056dd1da 100644 --- a/src/@dseries/log.m +++ b/src/@dseries/log.m @@ -2,13 +2,13 @@ function o = log(o) % --*-- Unitary tests --*-- % Apply the logarithm to all the variables in a dseries object (without in place modification). % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] -% Copyright (C) 2011-2016 Dynare Team +% Copyright (C) 2011-2017 Dynare Team % % This file is part of Dynare. % @@ -45,7 +45,7 @@ o.log_; %$ catch %$ t(1) = false; %$ end -%$ +%$ %$ if t(1) %$ t(2) = dassert(o, q); %$ t(3) = dassert(p.data, zeros(10, 2)); @@ -67,7 +67,7 @@ o.log_; %$ catch %$ t(1) = false; %$ end -%$ +%$ %$ if t(1) %$ t(2) = dassert(length(p.name), 2); %$ t(3) = dassert(p.name{1},'log(Variable_1)'); diff --git a/src/@dseries/log_.m b/src/@dseries/log_.m index a2cb469bccd94938db97a962a7501adf8a8bf75b..f9d96bb32af127ccea0f7bd47fca91e37fadf4b2 100644 --- a/src/@dseries/log_.m +++ b/src/@dseries/log_.m @@ -2,13 +2,13 @@ function o = log_(o) % --*-- Unitary tests --*-- % Apply the logarithm to all the variables in a dseries object (in place modification). % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] -% Copyright (C) 2011-2016 Dynare Team +% Copyright (C) 2011-2017 Dynare Team % % This file is part of Dynare. % @@ -74,7 +74,7 @@ o.data = log(o.data); %$ catch %$ t(1) = false; %$ end -%$ +%$ %$ if t(1) %$ t(2) = dassert(length(o.name), 2); %$ t(3) = dassert(o.name{1},'log(Variable_1)'); diff --git a/src/@dseries/merge.m b/src/@dseries/merge.m index 1e82168a4a857932871cb8d011a7b41bf8c9d4c6..b2de6911132a47e66000a0809307c83f24dcc7df 100644 --- a/src/@dseries/merge.m +++ b/src/@dseries/merge.m @@ -2,14 +2,14 @@ function q = merge(o, p) % --*-- Unitary tests --*-- % Merge method for dseries objects. % -% INPUTS +% INPUTS % - o [dseries] % - p [dseries] % -% OUTPUTS +% OUTPUTS % - q [dseries] % -% REMARKS +% REMARKS % If dseries objects o and p have common variables, the variables in p take precedence. % Copyright (C) 2013-2017 Dynare Team diff --git a/src/@dseries/minus.m b/src/@dseries/minus.m index 5fe4af70240749a620b0568299c6fc62925eeda2..f6dc52edf43c95754563389c45e9b1461872eca5 100644 --- a/src/@dseries/minus.m +++ b/src/@dseries/minus.m @@ -2,14 +2,14 @@ function q = minus(o, p) % --*-- Unitary tests --*-- % Overloads the minus operator for dseries objects. % -% INPUTS +% INPUTS % - o [dseries] % - p [dseries] % -% OUTPUTS +% OUTPUTS % - q [dseries] % -% EXAMPLE +% EXAMPLE % Define a dseries object: % % >> a = dseries(transpose(1:5)); @@ -17,17 +17,17 @@ function q = minus(o, p) % --*-- Unitary tests --*-- % Then we have % % >> a-a -% +% % ans is a dseries object: -% +% % | minus(Variable_1;Variable_1) -% 1Y | 0 -% 2Y | 0 -% 3Y | 0 -% 4Y | 0 -% 5Y | 0 +% 1Y | 0 +% 2Y | 0 +% 3Y | 0 +% 4Y | 0 +% 5Y | 0 -% Copyright (C) 2012-2016 Dynare Team +% Copyright (C) 2012-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/@dseries/mpower.m b/src/@dseries/mpower.m index 2beb41c3a00b402602573d57371879681008bed4..12f3909bc78e4b800aa12ff04af9bf343cc8e2be 100644 --- a/src/@dseries/mpower.m +++ b/src/@dseries/mpower.m @@ -2,11 +2,11 @@ function q = mpower(o, p) % --*-- Unitary tests --*-- % Overloads the power (^) operator for dseries objects. % -% INPUTS +% INPUTS % - o [dseries] T observations and N variables. % - p [dseries,double] scalar, vector or dseries object. % -% OUTPUTS +% OUTPUTS % - q [dseries] T observations and N variables. % Copyright (C) 2013-2017 Dynare Team diff --git a/src/@dseries/mrdivide.m b/src/@dseries/mrdivide.m index 531fcfd46fd34f460920e1d496beff8d8833b1e8..4a84531c58b8ab07b7369cb5b41baf068992f486 100644 --- a/src/@dseries/mrdivide.m +++ b/src/@dseries/mrdivide.m @@ -2,11 +2,11 @@ function q = mrdivide(o, p) % --*-- Unitary tests --*-- % Overloads the mrdivde (/) operator for dseries objects. % -% INPUTS +% INPUTS % - o [dseries] T observations and N variables. % - p [dseries,double] scalar, vector or dseries object. % -% OUTPUTS +% OUTPUTS % - q [dseries] T observations and N variables. % Copyright (C) 2013-2017 Dynare Team @@ -25,7 +25,7 @@ function q = mrdivide(o, p) % --*-- 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/>. - + if isnumeric(o) && (isscalar(o) || isvector(o)) if ~isdseries(p) error('dseries::mrdivide: Second input argument must be a dseries object!') @@ -42,7 +42,7 @@ if isnumeric(p) && (isscalar(p) || isvector(p)) q = copy(o); q.data = bsxfun(@rdivide, o.data, p); return -end +end if isdseries(o) && isdseries(p) % Element by element divisions of two dseries object diff --git a/src/@dseries/mtimes.m b/src/@dseries/mtimes.m index 6d1df4d088da1a0fb6983b6f0d6fcce58c3906db..e7a2d0da34e38b482fbd94612763a03ec7419408 100644 --- a/src/@dseries/mtimes.m +++ b/src/@dseries/mtimes.m @@ -2,11 +2,11 @@ function q = mtimes(o, p) % --*-- Unitary tests --*-- % Overloads the mtimes (*) operator for dseries objects. % -% INPUTS +% INPUTS % - o [dseries] T observations and N variables. % - p [dseries,double] scalar, vector or dseries object. % -% OUTPUTS +% OUTPUTS % - q [dseries] T observations and N variables. % Copyright (C) 2013-2017 Dynare Team diff --git a/src/@dseries/ne.m b/src/@dseries/ne.m index 77f4493fad932c2d3aa7f4d66683791992e38065..34b026fc368a18d19f2a8ca3018b4efb86cc9438 100644 --- a/src/@dseries/ne.m +++ b/src/@dseries/ne.m @@ -2,17 +2,17 @@ function b = ne(o, p) % --*-- Unitary tests --*-- % Overloads ne (~=) operator. % -% INPUTS +% INPUTS % o A dseries object (T periods, N variables). % o B dseries object (T periods, N variables). % -% OUTPUTS -% o C T*N matrix of zeros and ones. Element C(t,n) is nonzero iff observation t of variable n in A and B are different. +% OUTPUTS +% o C T*N matrix of zeros and ones. Element C(t,n) is nonzero iff observation t of variable n in A and B are different. % -% REMARKS -% If the number of variables, the number of observations or the frequencies are different in A and B, the function returns one. +% REMARKS +% If the number of variables, the number of observations or the frequencies are different in A and B, the function returns one. -% Copyright (C) 2013 Dynare Team +% Copyright (C) 2013-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/@dseries/plot.m b/src/@dseries/plot.m index f515c4187d7d563f3d8cc97e1c652e8d257785e3..01a12430b58bd4d986cdbe4453fc0dc147505f61 100644 --- a/src/@dseries/plot.m +++ b/src/@dseries/plot.m @@ -1,6 +1,6 @@ function h = plot(o, varargin) -% Overloads Matlab/Octave's plot function for dseries objects. +% Overloads Matlab/Octave's plot function for dseries objects. % Copyright (C) 2013-2017 Dynare Team % @@ -70,7 +70,7 @@ switch ndseries hh = plot(o0.data, o1.data, varargin{2:end}); else if length(varargin)>1 - message = sprintf('dseries::plot: dseries objects %s and %s have %d>1 variables but you passed additional arguments to the plot function.\n These additional arguments won''t ne interpreted. Use the Matlab/Octave set command and the plot\n handle instead if you wish to modify the properties of the plotted time series.',inputname(1),inputname(2),nvariables); + message = sprintf('dseries::plot: dseries objects %s and %s have %d>1 variables but you passed additional arguments to the plot function.\n These additional arguments won''t ne interpreted. Use the Matlab/Octave set command and the plot\n handle instead if you wish to modify the properties of the plotted time series.',inputname(1),inputname(2),nvariables); warning(message) end hh = plot(o0.data, o1.data); @@ -80,5 +80,5 @@ switch ndseries end if nargout - h = hh; + h = hh; end \ No newline at end of file diff --git a/src/@dseries/plus.m b/src/@dseries/plus.m index 1ffd13d15a34fff929f09e6717b5e3f85540c7c3..3e1d3bc05c9e0fb13e4e7197e0c4334f526ee020 100644 --- a/src/@dseries/plus.m +++ b/src/@dseries/plus.m @@ -2,14 +2,14 @@ function q = plus(o, p) % --*-- Unitary tests --*-- % Overloads the plus (+) operator for dseries objects. % -% INPUTS +% INPUTS % - o [dseries, real] % - p [dseries, real] % -% OUTPUTS +% OUTPUTS % - q [dseries] -% Copyright (C) 2011-2016 Dynare Team +% Copyright (C) 2011-2017 Dynare Team % % This file is part of Dynare. % @@ -128,7 +128,7 @@ end %$ ts1 = dseries(A,[],A_name,[]); %$ ts2 = dseries(B,[],B_name,[]); %$ ts3 = ts1+ts2; -%$ ts4 = ts3+ts1; +%$ ts4 = ts3+ts1; %$ t(1) = true; %$ catch %$ t = false; diff --git a/src/@dseries/pop.m b/src/@dseries/pop.m index a623074b3959e57bc267b2d8e2cd5ebedfcfce2c..afc2913c62e22091bdb0f3d7903b1c779b3a520f 100644 --- a/src/@dseries/pop.m +++ b/src/@dseries/pop.m @@ -2,11 +2,11 @@ function [o, id] = pop(o, a) % --*-- Unitary tests --*-- % Removes a variable from a dseries object. % -% INPUTS +% INPUTS % - o [dseries] T observations and N variables. % - a [string] Name of the variable to be removed. % -% OUTPUTS +% OUTPUTS % - o [dseries] T observations and N-1 variables. % Copyright (C) 2013-2017 Dynare Team diff --git a/src/@dseries/pop_.m b/src/@dseries/pop_.m index abd3bcb764f080a3b36fc08ecbd62e80cd7d6437..a5e478895a356e126f7f5324432398954a8d1c8b 100644 --- a/src/@dseries/pop_.m +++ b/src/@dseries/pop_.m @@ -2,11 +2,11 @@ function [o, id] = pop_(o, a) % --*-- Unitary tests --*-- % Removes a variable from a dseries object. % -% INPUTS +% INPUTS % - o [dseries] T observations and N variables. % - a [string] Name of the variable to be removed. % -% OUTPUTS +% OUTPUTS % - o [dseries] T observations and N-1 variables. % Copyright (C) 2013-2017 Dynare Team diff --git a/src/@dseries/qdiff.m b/src/@dseries/qdiff.m index c3ae5454ce2283e29e0add62e298f217c3e5999f..54234cb278d7c7f3efbd45c696f598d0ba41b8cd 100644 --- a/src/@dseries/qdiff.m +++ b/src/@dseries/qdiff.m @@ -2,10 +2,10 @@ function o = qdiff(o) % --*-- Unitary tests --*-- % Computes quaterly differences. % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2012-2017 Dynare Team diff --git a/src/@dseries/qdiff_.m b/src/@dseries/qdiff_.m index 22fc244fe08e1f9600dfc3f51c7c826c2c034738..cb6d76a0ea231c1bdf41f610caf3f2958910a8b9 100644 --- a/src/@dseries/qdiff_.m +++ b/src/@dseries/qdiff_.m @@ -2,10 +2,10 @@ function o = qdiff_(o) % --*-- Unitary tests --*-- % Computes quaterly differences. % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2012-2017 Dynare Team diff --git a/src/@dseries/qgrowth.m b/src/@dseries/qgrowth.m index 65ee58cabdc37f6035d2057e429049be440c58d9..ece4bca6cae555a2341e63376bf11f59bcaeeb51 100644 --- a/src/@dseries/qgrowth.m +++ b/src/@dseries/qgrowth.m @@ -1,11 +1,11 @@ -function o = qgrowth_(o) % --*-- Unitary tests --*-- +function o = qgrowth(o) % --*-- Unitary tests --*-- % Computes quaterly growth rates. % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2012-2017 Dynare Team diff --git a/src/@dseries/qgrowth_.m b/src/@dseries/qgrowth_.m index 98971e8df8fe07ebfb2a5289385233f29455b4a6..7e975fff5594a541d2f4786429d5ef46ff4e8183 100644 --- a/src/@dseries/qgrowth_.m +++ b/src/@dseries/qgrowth_.m @@ -2,10 +2,10 @@ function o = qgrowth_(o) % --*-- Unitary tests --*-- % Computes quaterly growth rates. % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2012-2017 Dynare Team diff --git a/src/@dseries/rename.m b/src/@dseries/rename.m index 3607321321b1311743a4d1711a1be6d3580b52a3..7c80238dcc3134273edb8dbb562acbaf38229b61 100644 --- a/src/@dseries/rename.m +++ b/src/@dseries/rename.m @@ -1,13 +1,13 @@ -function o = rename_(o, old, new) % --*-- Unitary tests --*-- +function o = rename(o, old, new) % --*-- Unitary tests --*-- % Renames variables in a dseries object. % -% INPUTS +% INPUTS % - o [dseries] % - old [string, cell] % - new [string, cell] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2013-2017 Dynare Team @@ -31,7 +31,7 @@ o = copy(o); if nargin<3 o.rename_(old); else - o.rename_(old, new); + o.rename_(old, new); end %@test:1 diff --git a/src/@dseries/rename_.m b/src/@dseries/rename_.m index 76cc532e5419090813beb37ca8fa032b6146260b..913a20940389cd16e9bcd3e80a979da87a5a092e 100644 --- a/src/@dseries/rename_.m +++ b/src/@dseries/rename_.m @@ -2,12 +2,12 @@ function o = rename_(o, old, new) % --*-- Unitary tests --*-- % Renames variables in a dseries object. % -% INPUTS +% INPUTS % - o [dseries] % - old [string, cell] % - new [string, cell] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2013-2017 Dynare Team diff --git a/src/@dseries/save.m b/src/@dseries/save.m index 78b10cd2c122194f0295c412eb9f79a069d92780..18f3c7ff56d71a1ab094abc36bf76acd6a413953 100644 --- a/src/@dseries/save.m +++ b/src/@dseries/save.m @@ -2,7 +2,7 @@ function save(A,basename,format) % --*-- Unitary tests --*-- % Saves a dseries object on disk. -% Copyright (C) 2013-2016 Dynare Team +% Copyright (C) 2013-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/@dseries/set_names.m b/src/@dseries/set_names.m index cf54735e38b096a3b9cdcb53381eca8240263795..96bfb219452f9fc44fcd897f479b98e3458d6373 100644 --- a/src/@dseries/set_names.m +++ b/src/@dseries/set_names.m @@ -2,11 +2,11 @@ function o = set_names(o,varargin) % --*-- Unitary tests --*-- % Specifies names of the variables in a dseries object (in place modification). % -% INPUTS +% INPUTS % - o [dseries] % - s1, s2, s3, ... [string] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2017 Dynare Team @@ -59,7 +59,7 @@ end %$ catch %$ t = 0; %$ end -%$ +%$ %$ if length(t)>1 %$ t(2) = dassert(ts1.vobs,3); %$ t(3) = dassert(ts1.nobs,10); diff --git a/src/@dseries/size.m b/src/@dseries/size.m index 22b8ad4c8addfd8037bdba46c2544e671ecc4c9f..23dbcd6648707623a90af04e87d1c026dd604c7d 100644 --- a/src/@dseries/size.m +++ b/src/@dseries/size.m @@ -1,6 +1,6 @@ function varargout = size(o, varargin) -% Overloads size function. +% Overloads size function. % Copyright (C) 2013-2017 Dynare Team % diff --git a/src/@dseries/std.m b/src/@dseries/std.m index cdbe7c05304e8466daee017ac466e16b46a12680..a84c82bc3373c8f15ac9f6dd091b2d6344855481 100644 --- a/src/@dseries/std.m +++ b/src/@dseries/std.m @@ -96,7 +96,7 @@ end %$ catch %$ t = 0; %$ end -%$ +%$ %$ if t(1) %$ t(2) = dassert(isequal(size(s),[1, 2]), true); %$ t(3) = dassert(max(abs(s-[.1, .1]))<.0001, true); @@ -116,7 +116,7 @@ end %$ catch %$ t = 0; %$ end -%$ +%$ %$ if t(1) %$ t(2) = dassert(isequal(size(s),[1, 2]), true); %$ t(3) = dassert(max(abs(s-[.1, .1]))<.0001, true); diff --git a/src/@dseries/subsasgn.m b/src/@dseries/subsasgn.m index 3328ec9a8b5b7d5566b344e4c6bb27ef3b569b93..4b5944b1291576a2a6f31f7524dcac93f2b45d74 100644 --- a/src/@dseries/subsasgn.m +++ b/src/@dseries/subsasgn.m @@ -8,7 +8,7 @@ function A = subsasgn(A,S,B) % --*-- Unitary tests --*-- %! @end deftypefn %@eod: -% Copyright (C) 2012-2016 Dynare Team +% Copyright (C) 2012-2017 Dynare Team % % This file is part of Dynare. % @@ -28,151 +28,151 @@ function A = subsasgn(A,S,B) % --*-- Unitary tests --*-- merge_dseries_objects = 1; switch length(S) - case 1 - switch S(1).type - case '{}' % Multiple variable selection. - if ~isequal(numel(S(1).subs),numel(unique(S(1).subs))) - error('dseries::subsasgn: Wrong syntax!') - end - for i=1:numel(S(1).subs) - element = S(1).subs{i}; - % Implicit loop. - idArobase = strfind(element,'@'); - if mod(length(idArobase),2) - error('dseries::subsasgn: (Implicit loops) The number of @ symbols must be even!') - end - % regular expression. - idBracket.open = strfind(element, '['); - idBracket.close = strfind(element, ']'); - if ~isequal(length(idBracket.open),length(idBracket.open)) - error('dseries::subsasgn: (Matlab/Octave''s regular expressions) Check opening and closing square brackets!') - end - % Loops and regular expressions are not compatible - if length(idArobase) && length(idBracket.open) - error(['dseries::subsasgn: You cannot use implicit loops and regular expressions in the same rule!']) - end - if ~isempty(idArobase) - elements = build_list_of_variables_with_loops({}, idArobase, element, {}); - S(1).subs = replace_object_in_a_one_dimensional_cell_array(S(1).subs, elements(:), i); - end - if ~isempty(idBracket.open) - elements = build_list_of_variables_with_regexp(A.name, idBracket, element, {}); - S(1).subs = replace_object_in_a_one_dimensional_cell_array(S(1).subs, elements(:), i); - end - end - if isempty(B) - for i=1:length(S(1).subs) - A = remove(A,S(1).subs{i}); - end - return - end - if ~isequal(length(S(1).subs),vobs(B)) - error('dseries::subsasgn: Wrong syntax!') - end - if ~isequal(S(1).subs(:),B.name) - for i = 1:vobs(B) - if ~isequal(S(1).subs{i},B.name{i}) - % Rename a variable. - id = find(strcmp(S(1).subs{i},A.name)); - if isempty(id) - % Add a new variable a change its name. - B.name(i) = {S(1).subs{i}}; - B.tex(i) = {name2tex(S(1).subs{i})}; - else - % Rename variable and change its content. - B.name(i) = A.name(id); - B.tex(i) = A.tex(id); - end - end - end - end - case '.' - if isequal(S(1).subs,'init') && isdates(B) && isequal(length(B),1) - % Change the initial date (update dates member) - A.dates = B:B+(nobs(A)-1); - return - elseif isequal(S(1).subs,'dates') && isdates(B) - % Overwrite the dates member - A.dates = B; - return - elseif ismember(S(1).subs,{'data','name','tex'}) - error(['dseries::subsasgn: You cannot overwrite ' S(1).subs ' member!']) - elseif ~isequal(S(1).subs,B.name) - % Single variable selection. - if ~isequal(S(1).subs,B.name{1}) - % Rename a variable. - id = find(strcmp(S(1).subs,A.name)); - if isempty(id) - % Add a new variable a change its name. - B.name(1) = {S(1).subs}; - B.tex(1) = {name2tex(S(1).subs)}; - else - % Rename variable and change its content. - B.name(1) = A.name(id); - B.tex(1) = A.tex(id); - end - end - end - case '()' % Date(s) selection - if isdates(S(1).subs{1}) || isdate(S(1).subs{1}) - if isdate(S(1).subs{1}) - Dates = dates(S(1).subs{1}); + case 1 + switch S(1).type + case '{}' % Multiple variable selection. + if ~isequal(numel(S(1).subs),numel(unique(S(1).subs))) + error('dseries::subsasgn: Wrong syntax!') + end + for i=1:numel(S(1).subs) + element = S(1).subs{i}; + % Implicit loop. + idArobase = strfind(element,'@'); + if mod(length(idArobase),2) + error('dseries::subsasgn: (Implicit loops) The number of @ symbols must be even!') + end + % regular expression. + idBracket.open = strfind(element, '['); + idBracket.close = strfind(element, ']'); + if ~isequal(length(idBracket.open),length(idBracket.open)) + error('dseries::subsasgn: (Matlab/Octave''s regular expressions) Check opening and closing square brackets!') + end + % Loops and regular expressions are not compatible + if length(idArobase) && length(idBracket.open) + error(['dseries::subsasgn: You cannot use implicit loops and regular expressions in the same rule!']) + end + if ~isempty(idArobase) + elements = build_list_of_variables_with_loops({}, idArobase, element, {}); + S(1).subs = replace_object_in_a_one_dimensional_cell_array(S(1).subs, elements(:), i); + end + if ~isempty(idBracket.open) + elements = build_list_of_variables_with_regexp(A.name, idBracket, element, {}); + S(1).subs = replace_object_in_a_one_dimensional_cell_array(S(1).subs, elements(:), i); + end + end + if isempty(B) + for i=1:length(S(1).subs) + A = remove(A,S(1).subs{i}); + end + return + end + if ~isequal(length(S(1).subs),vobs(B)) + error('dseries::subsasgn: Wrong syntax!') + end + if ~isequal(S(1).subs(:),B.name) + for i = 1:vobs(B) + if ~isequal(S(1).subs{i},B.name{i}) + % Rename a variable. + id = find(strcmp(S(1).subs{i},A.name)); + if isempty(id) + % Add a new variable a change its name. + B.name(i) = {S(1).subs{i}}; + B.tex(i) = {name2tex(S(1).subs{i})}; + else + % Rename variable and change its content. + B.name(i) = A.name(id); + B.tex(i) = A.tex(id); + end + end + end + end + case '.' + if isequal(S(1).subs,'init') && isdates(B) && isequal(length(B),1) + % Change the initial date (update dates member) + A.dates = B:B+(nobs(A)-1); + return + elseif isequal(S(1).subs,'dates') && isdates(B) + % Overwrite the dates member + A.dates = B; + return + elseif ismember(S(1).subs,{'data','name','tex'}) + error(['dseries::subsasgn: You cannot overwrite ' S(1).subs ' member!']) + elseif ~isequal(S(1).subs,B.name) + % Single variable selection. + if ~isequal(S(1).subs,B.name{1}) + % Rename a variable. + id = find(strcmp(S(1).subs,A.name)); + if isempty(id) + % Add a new variable a change its name. + B.name(1) = {S(1).subs}; + B.tex(1) = {name2tex(S(1).subs)}; else - Dates = S(1).subs{1}; + % Rename variable and change its content. + B.name(1) = A.name(id); + B.tex(1) = A.tex(id); end - [junk, tdx] = intersect(A.dates.time,Dates.time,'rows'); - if isdseries(B) - [junk, tdy] = intersect(B.dates.time,Dates.time,'rows'); - if isempty(tdy) - error('dseries::subsasgn: Periods of the dseries objects on the left and right hand sides must intersect!') - end - if ~isequal(vobs(A), vobs(B)) - error('dseries::subsasgn: Dimension error! The number of variables on the left and right hand side must match.') - end - A.data(tdx,:) = B.data(tdy,:); - merge_dseries_objects = 0; - elseif isnumeric(B) - merge_dseries_objects = 0; - if isequal(length(tdx),rows(B)) - if isequal(columns(A.data),columns(B)) - A.data(tdx,:) = B; - else - error('dseries::subsasgn: Dimension error! The number of variables on the left and right hand side must match.') - end - else - error('dseries::subsassgn: Dimension error! The number of periods on the left and right hand side must match.') - end - else - error('dseries::subsasgn: The object on the right hand side must be a dseries object or a numeric array!') - end - elseif ischar(S(1).subs{1}) && isequal(S(1).subs{1},':') && isempty(A) - if isnumeric(B) - A.data = B; - A.name = default_name(vobs(A)); - A.tex = name2tex(A.name); - if isempty(A.dates) - if isempty(A.dates.freq) - init = dates('1Y') - else - init = dates(A.dates.freq, 1, 1); - end - else - init = A.dates(1); - end - A.dates = init:(init+rows(B)-1); - elseif isdseries(B) - A.data = B.data; - A.name = B.name; - A.tex = N.tex; - A.dates = B.dates; - end - return - else - error('dseries::subsasgn: Wrong syntax!') - end - otherwise - error('dseries::subsasgn: Wrong syntax!') - end + end + end + case '()' % Date(s) selection + if isdates(S(1).subs{1}) || isdate(S(1).subs{1}) + if isdate(S(1).subs{1}) + Dates = dates(S(1).subs{1}); + else + Dates = S(1).subs{1}; + end + [junk, tdx] = intersect(A.dates.time,Dates.time,'rows'); + if isdseries(B) + [junk, tdy] = intersect(B.dates.time,Dates.time,'rows'); + if isempty(tdy) + error('dseries::subsasgn: Periods of the dseries objects on the left and right hand sides must intersect!') + end + if ~isequal(vobs(A), vobs(B)) + error('dseries::subsasgn: Dimension error! The number of variables on the left and right hand side must match.') + end + A.data(tdx,:) = B.data(tdy,:); + merge_dseries_objects = 0; + elseif isnumeric(B) + merge_dseries_objects = 0; + if isequal(length(tdx),rows(B)) + if isequal(columns(A.data),columns(B)) + A.data(tdx,:) = B; + else + error('dseries::subsasgn: Dimension error! The number of variables on the left and right hand side must match.') + end + else + error('dseries::subsassgn: Dimension error! The number of periods on the left and right hand side must match.') + end + else + error('dseries::subsasgn: The object on the right hand side must be a dseries object or a numeric array!') + end + elseif ischar(S(1).subs{1}) && isequal(S(1).subs{1},':') && isempty(A) + if isnumeric(B) + A.data = B; + A.name = default_name(vobs(A)); + A.tex = name2tex(A.name); + if isempty(A.dates) + if isempty(A.dates.freq) + init = dates('1Y') + else + init = dates(A.dates.freq, 1, 1); + end + else + init = A.dates(1); + end + A.dates = init:(init+rows(B)-1); + elseif isdseries(B) + A.data = B.data; + A.name = B.name; + A.tex = N.tex; + A.dates = B.dates; + end + return + else + error('dseries::subsasgn: Wrong syntax!') + end + otherwise + error('dseries::subsasgn: Wrong syntax!') + end case 2 merge_dseries_objects = 0; if ((isequal(S(1).type,'{}') || isequal(S(1).type,'.')) && isequal(S(2).type,'()')) diff --git a/src/@dseries/tex_rename.m b/src/@dseries/tex_rename.m index c903fc86c156b06bb5a49aefec2504335ea58483..cd50aabe2ebfd89a2a5b2b6dbd337c8d2aa71677 100644 --- a/src/@dseries/tex_rename.m +++ b/src/@dseries/tex_rename.m @@ -1,6 +1,6 @@ function o = tex_rename(o, varargin) % --*-- Unitary tests --*-- -% Copyright (C) 2013-2015 Dynare Team +% Copyright (C) 2013-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/@dseries/tex_rename_.m b/src/@dseries/tex_rename_.m index 33450efe51f9c4d4367c138c19f159dbe88a0192..3608b5b67dd04ce64cc2c559452aba603de08225 100644 --- a/src/@dseries/tex_rename_.m +++ b/src/@dseries/tex_rename_.m @@ -2,19 +2,19 @@ function o = tex_rename_(o, varargin) % --*-- Unitary tests --*-- % Changes TeX name of variables in a dseries object. % -% INPUTS +% INPUTS % - o [dseries] % - names_1 [string, cell] % - names_2 [string] % -% OUTPUTS +% OUTPUTS % - o [dseries] % -% REMARKS +% REMARKS % If varargin has only one element (string or cell of strings) then this input defines the new % texnames for all the variables in dseries object o. If varargin has two elements (strings) the % first element is the name of the variable and the second argument is the new texname for this -% variable. +% variable. % Copyright (C) 2013-2017 Dynare Team % @@ -47,7 +47,7 @@ end assert(ischar(newtexname) || (iscellstr(newtexname) && length(newtexname) == vobs(o)), ... ['dseries::tex_rename: third input argument (newtexname) name must either be a string' ... - ' or a cell array of strings with the same number of entries as varibles in the dseries']); + ' or a cell array of strings with the same number of entries as varibles in the dseries']); if nargin == 2 idname = 1; diff --git a/src/@dseries/uminus.m b/src/@dseries/uminus.m index 33fed6c44f7a559eefad51b8d709a0fae5361b1c..283a9b3e085e13a4427c2d29cc86ec1261901804 100644 --- a/src/@dseries/uminus.m +++ b/src/@dseries/uminus.m @@ -2,10 +2,10 @@ function o = uminus(o) % --*-- Unitary tests --*-- % Overloads the uminus method for dseries objects. % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2012-2017 Dynare Team diff --git a/src/@dseries/vertcat.m b/src/@dseries/vertcat.m index 17d684f394d148a1b1a1e2d1f2a1fb428e98f487..84f207142e784087357b0f5595c160b641f89942 100644 --- a/src/@dseries/vertcat.m +++ b/src/@dseries/vertcat.m @@ -2,17 +2,17 @@ function o = vertcat(varargin) % --*-- Unitary tests --*-- % Overloads vertcat method for dseries objects. % -% INPUTS +% INPUTS % o o1 dseries object. % o o2 dseries object. % o ... % -% OUTPUTS +% OUTPUTS % o o dseries object. % -% EXAMPLE 1 +% EXAMPLE 1 % If o1, o2 and o3 are dseries objects containing the same variables over different samples, the following syntax: -% +% % o = [o1; o2; o3] ; % % merges the samples. @@ -46,29 +46,29 @@ elseif nargin>1 end function d = vertcat_(b, c) - d = NaN; - if ~isequal(frequency(b), frequency(c)) - error('dseries::vertcat: Frequencies must be common!') - 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) - [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 - d.data = [b.data; c.data(:,idx)]; +d = NaN; +if ~isequal(frequency(b), frequency(c)) + error('dseries::vertcat: Frequencies must be common!') +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) + [t, idx] = ismember(b.name, c.name); + if all(t) + reorder_variables_in_c = true; else - d.data = [b.data; c.data]; + error('dseries::vertcat: Variables must be common!') end - d.dates = [b.dates; c.dates]; +end +d = b; +if reorder_variables_in_c + d.data = [b.data; c.data(:,idx)]; +else + d.data = [b.data; c.data]; +end +d.dates = [b.dates; c.dates]; %@test:1 %$ % Define a data set. diff --git a/src/@dseries/vobs.m b/src/@dseries/vobs.m index 5af584706d93cac1e3a01f29690d4b5a9b82024a..f5a790b2c2c89c0c0aafcc05e823dceded3eac13 100644 --- a/src/@dseries/vobs.m +++ b/src/@dseries/vobs.m @@ -1,11 +1,11 @@ function s = vobs(o) % Returns the number of variables in a @dseries object. -% -% INPUTS +% +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - s [integer] scalar, number of variables in o. % Copyright (C) 2014-2017 Dynare Team diff --git a/src/@dseries/ydiff.m b/src/@dseries/ydiff.m index e2983c3708dfc2e62d695f5976867d19d2f13f3b..381a1b49753a2752812a07ebb032ecfda20e4455 100644 --- a/src/@dseries/ydiff.m +++ b/src/@dseries/ydiff.m @@ -2,10 +2,10 @@ function o = ydiff(o) % --*-- Unitary tests --*-- % Computes yearly differences. % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2012-2017 Dynare Team diff --git a/src/@dseries/ydiff_.m b/src/@dseries/ydiff_.m index d11d86f4eeb1ae0cbd0a1de8e271ec56d55ae389..f3be2b86a28cdb4329eb3d1c6e8edceb9a04457e 100644 --- a/src/@dseries/ydiff_.m +++ b/src/@dseries/ydiff_.m @@ -2,10 +2,10 @@ function o = ydiff_(o) % --*-- Unitary tests --*-- % Computes yearly differences. % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2012-2017 Dynare Team diff --git a/src/@dseries/ygrowth.m b/src/@dseries/ygrowth.m index aba3a062dd71fcf045aba9350bd4a9a70d4e1df3..a3e08841225b59c22665ae4c41a818395979b164 100644 --- a/src/@dseries/ygrowth.m +++ b/src/@dseries/ygrowth.m @@ -2,10 +2,10 @@ function o = ygrowth(o) % --*-- Unitary tests --*-- % Computes yearly growth rates. % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2012-2017 Dynare Team diff --git a/src/@dseries/ygrowth_.m b/src/@dseries/ygrowth_.m index aa9934cc41560b01b3a76448ac35ff7e97b7ccea..926e55dbbb962b680797878596c5d6dd25e6c4d9 100644 --- a/src/@dseries/ygrowth_.m +++ b/src/@dseries/ygrowth_.m @@ -2,10 +2,10 @@ function o = ygrowth_(o) % --*-- Unitary tests --*-- % Computes yearly growth rates. % -% INPUTS +% INPUTS % - o [dseries] % -% OUTPUTS +% OUTPUTS % - o [dseries] % Copyright (C) 2012-2017 Dynare Team diff --git a/src/@x13/clean.m b/src/@x13/clean.m index 44e7bce0b8e44c61292c9b4379bc3aa1fb8f1604..9d87ad979d9ce1422fba48be2750bbd7452c5a9e 100644 --- a/src/@x13/clean.m +++ b/src/@x13/clean.m @@ -9,7 +9,7 @@ function clean(o) % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. diff --git a/src/@x13/subsasgn.m b/src/@x13/subsasgn.m index 1ce18c2380dce19049eb9df54ca95f34d5df7cae..33353b31a3d2c32270306c0a0ec9b355687250b4 100644 --- a/src/@x13/subsasgn.m +++ b/src/@x13/subsasgn.m @@ -7,7 +7,7 @@ function val = subsasgn(val, idx, rhs) % --*-- Unitary tests --*-- % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. diff --git a/src/@x13/x13.m b/src/@x13/x13.m index 466e76d6870fe27133661cb32f80b04fe5312ad8..2eeece9009bf8490bdaf20b7bd01c57be3d74d6b 100644 --- a/src/@x13/x13.m +++ b/src/@x13/x13.m @@ -9,7 +9,7 @@ classdef x13<handle % --*-- Unitary tests --*-- % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. @@ -17,23 +17,23 @@ 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 - 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. - end +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. +end - methods +methods function o = x13(y, x) % Constructor for the x13 class. % @@ -42,41 +42,9 @@ classdef x13<handle % --*-- Unitary tests --*-- % % OUPUTS % - o [x13] Empty object except for the data. - if ~nargin - 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'); - o.outlier = setdefaultmember('outlier'); - o.forecast = setdefaultmember('forecast'); - o.check = setdefaultmember('check'); - o.x11 = setdefaultmember('x11'); - o.results = struct(); - o.commands = {}; - return - end - if isdseries(y) - if isequal(y.vobs, 1) - o.y = y; - else - error('x13:: Wrong input argument (a dseries object with a single variable is expected)!') - end - else - error('x13:: Wrong input argument (a dseries object is expected)!') - end - if nargin>1 - if isdseries(x) - o.x = x; - else - error('x13:: Wrong input argument (a dseries object is expected)!') - end - else - o.x = dseries(); - end - % Initialize other members (they are empty initially and must be set by calling methods) + if ~nargin + o.y = dseries(); + o.x = dseries(); o.arima = setdefaultmember('arima'); o.automdl = setdefaultmember('automdl'); o.regression = setdefaultmember('regression'); @@ -88,6 +56,38 @@ classdef x13<handle % --*-- Unitary tests --*-- o.x11 = setdefaultmember('x11'); o.results = struct(); o.commands = {}; + return + end + if isdseries(y) + if isequal(y.vobs, 1) + o.y = y; + else + error('x13:: Wrong input argument (a dseries object with a single variable is expected)!') + end + else + error('x13:: Wrong input argument (a dseries object is expected)!') + end + if nargin>1 + if isdseries(x) + o.x = x; + else + error('x13:: Wrong input argument (a dseries object is expected)!') + end + else + o.x = dseries(); + 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'); + o.outlier = setdefaultmember('outlier'); + o.forecast = setdefaultmember('forecast'); + o.check = setdefaultmember('check'); + o.x11 = setdefaultmember('x11'); + o.results = struct(); + o.commands = {}; end - end +end end \ No newline at end of file diff --git a/src/initialize_dseries_toolbox.m b/src/initialize_dseries_toolbox.m index 31060c862fbb5fc8c0406c61e7358f1fd6dbdd9a..0adcdf571e97e168c187f31a9d4e58bf541536f6 100644 --- a/src/initialize_dseries_toolbox.m +++ b/src/initialize_dseries_toolbox.m @@ -1,3 +1,18 @@ +% Copyright (C) 2015-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/>. + % Check that the dates module is available. try initialize_dates_toolbox; diff --git a/src/read/load_csv_file_data.m b/src/read/load_csv_file_data.m index 1ff0ff24ce4928a82d18cf805b1d318d62e32c5b..32b6b52848e5b108b170d807d098cd6e10fe7415 100644 --- a/src/read/load_csv_file_data.m +++ b/src/read/load_csv_file_data.m @@ -2,21 +2,21 @@ function [freq, init, data, varlist] = load_csv_file_data(file) % --*-- Unitary %function [freq, init, data, varlist] = load_csv_file_data(file) % Loads data in a csv file. % -% INPUTS +% INPUTS % o file string, name of the csv file (with path). % -% OUTPUTS +% OUTPUTS % o freq integer scalar equal to 1, 4, 12 or 52 (for annual, quaterly, monthly or weekly frequencies). % o init dates object, initial date in the dataset. % o data matrix of doubles, the data. % o varlist cell of strings, names of the variables. % -% REMARKS +% REMARKS % The varlist output will be set only if the first line contains variable % names. Similarly, if the first column does not contain dates, then % freq will be 1 and init will be year 1. -% Copyright (C) 2012-2016 Dynare Team +% Copyright (C) 2012-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/read/load_data.m b/src/read/load_data.m index d0606c6712cd03bed6e202cd70439a32f0c1eeb3..fb745a29fe0c1b964c248a0875821e8e5166f7aa 100644 --- a/src/read/load_data.m +++ b/src/read/load_data.m @@ -1,9 +1,9 @@ function [init, data, varlist, tex] = load_data(filename) -% INPUTS +% INPUTS % - filename [string] Name of the file containing data. % -% OUTPUTS +% OUTPUTS % - init [dates] Initial period. % - data [double] Array of data (T*N). % - varlist [cell] Names of the N variables (as strings). @@ -16,7 +16,7 @@ function [init, data, varlist, tex] = load_data(filename) % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. diff --git a/src/read/load_m_file_data.m b/src/read/load_m_file_data.m index 5c2e47881fd817154139fc5db5b85cb9dedc6b5f..14e2220ba1e87c3035700d48abc6e40cee9867af 100644 --- a/src/read/load_m_file_data.m +++ b/src/read/load_m_file_data.m @@ -2,21 +2,21 @@ function [freq,init,data,varlist,tex] = load_m_file_data(file) % Loads data in a matlab/octave script. % -% INPUTS +% INPUTS % o file string, name of the matlab/octave script (with path) % -% OUTPUTS +% OUTPUTS % o freq integer scalar equal to 1, 4, 12 or 52 (for annual, quaterly, monthly or weekly frequencies). % o init dates object, initial date in the dataset. % o data matrix of doubles, the data. % o varlist cell of strings, names of the variables. % -% REMARKS -% The frequency and initial date can be specified with variables FREQ__ and INIT__ in the matlab/octave script. FREQ__ must -% be a scalar integer and INIT__ a string like '1938M11', '1945Q3', '1973W3' or '2009A'. If these variables are not specified +% REMARKS +% The frequency and initial date can be specified with variables FREQ__ and INIT__ in the matlab/octave script. FREQ__ must +% be a scalar integer and INIT__ a string like '1938M11', '1945Q3', '1973W3' or '2009A'. If these variables are not specified % default values for freq and init are 1 and dates(1,1). -% Copyright (C) 2012-2013 Dynare Team +% Copyright (C) 2012-2017 Dynare Team % % This file is part of Dynare. % @@ -94,7 +94,7 @@ if isempty(varlist0) || isequal(list_of_variables(current_variable_index).name,'varlist0') ... || isequal(list_of_variables(current_variable_index).name,'list_of_variables') ... || isequal(list_of_variables(current_variable_index).name,'tex') ... - continue + continue end if list_of_variables(current_variable_index).global || list_of_variables(current_variable_index).persistent % A variable cannot be a global or persistent variable. @@ -117,7 +117,7 @@ if isempty(varlist0) end else for current_variable_index=1:length(varlist0) - eval(['data = [data, ' varlist0{current_variable_index} '];']) + eval(['data = [data, ' varlist0{current_variable_index} '];']) end varlist = varlist0; end diff --git a/src/read/load_mat_file_data.m b/src/read/load_mat_file_data.m index b44124515541d7bd9d8606d7eae82d7f031541f2..8f12c7ad4ef227314b5ba055f55e023238c36876 100644 --- a/src/read/load_mat_file_data.m +++ b/src/read/load_mat_file_data.m @@ -2,21 +2,21 @@ function [freq,init,data,varlist,tex] = load_mat_file_data(file) % --*-- Unitar % Loads data in a matlab/octave mat-file. % -% INPUTS +% INPUTS % o file string, name of the matlab/octave mat file (with path) % -% OUTPUTS +% OUTPUTS % o freq integer scalar equal to 1, 4, 12 or 52 (for annual, quaterly, monthly or weekly frequencies). % o init dates object, initial date in the dataset. % o data matrix of doubles, the data. % o varlist cell of strings, names of the variables. % -% REMARKS -% The frequency and initial date can be specified with variables FREQ__ and INIT__ in the matlab/octave binary file. FREQ__ must -% be a scalar integer and INIT__ a string like '1938M11', '1945Q3', '1973W3' or '2009A'. If these variables are not specified +% REMARKS +% The frequency and initial date can be specified with variables FREQ__ and INIT__ in the matlab/octave binary file. FREQ__ must +% be a scalar integer and INIT__ a string like '1938M11', '1945Q3', '1973W3' or '2009A'. If these variables are not specified % default values for freq and init are 1 and dates(1,1). -% Copyright (C) 2012-2014 Dynare Team +% Copyright (C) 2012-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/read/load_xls_file_data.m b/src/read/load_xls_file_data.m index d8565bcab8427263b6adce129ce47236258b5aa1..2030bd4ff550c48e64b607f1c2075741efc62c6c 100644 --- a/src/read/load_xls_file_data.m +++ b/src/read/load_xls_file_data.m @@ -2,21 +2,21 @@ function [freq, init, data, varlist] = load_xls_file_data(file, sheet, range) % Loads data in a xls file. % -% INPUTS +% INPUTS % o file string, name of the file (with extension). % o sheet string, name of the sheet to be read. % o range string of the form 'B2:D6' % -% OUTPUTS +% OUTPUTS % o freq integer scalar (1, 4, 12 or 52), code for frequency. % o init dates object, initial date of the sample. % o data matrix of doubles, the raw data. % o varlist cell of strings (column), names of the variables in the database. % -% REMARKS +% REMARKS % The range argument is only available on windows platform (with Excel installed). -% Copyright (C) 2013-2016 Dynare Team +% Copyright (C) 2013-2017 Dynare Team % % This file is part of Dynare. % @@ -45,13 +45,13 @@ if nargin<3 || isempty(range) end if isoctave && ~user_has_octave_forge_package('io') - try - pkg load io - catch - error(['The io package is required to read CSV files from Octave. ' ... - 'It can be installed by running the following from the Octave ' ... - ' command line: pkg install -forge io']); - end + try + pkg load io + catch + error(['The io package is required to read CSV files from Octave. ' ... + 'It can be installed by running the following from the Octave ' ... + ' command line: pkg install -forge io']); + end end % Check file extension. @@ -93,18 +93,18 @@ if isequal(t1,0) && isequal(t2,0) notime = 1; noname = 1; elseif isequal(t2,1) && t1>=t2 && n2~=t2 %only one column present, but no var name in header text - % The file contains no informations about the dates. + % The file contains no informations about the dates. notime = 0; noname = 1; elseif isequal(t2,1) && t1>=t2 && n2==t2 %only one column present with var name in header text - % The file contains no informations about the variables. + % The file contains no informations about the variables. notime = 1; noname = 0; elseif isequal(t1,1) && t2>=t1 % The file contains no informations about the dates. notime = 1; noname = 0; -else +else % The file contains informations about the variables and dates. notime = 0; noname = 0; @@ -141,7 +141,7 @@ if ~noname else varlist = transpose(txt(1,2:end)); end - % Remove leading and trailing white spaces + % Remove leading and trailing white spaces for i=1:length(varlist) varlist(i) = {strtrim(varlist{i})}; end diff --git a/src/utilities/file/check_file_extension.m b/src/utilities/file/check_file_extension.m index 70107015e0e3c38bd24fbe2dc2358b10e0beeb30..6afa14fc5fcb4a6806d670caa2b09c556e144847 100644 --- a/src/utilities/file/check_file_extension.m +++ b/src/utilities/file/check_file_extension.m @@ -3,15 +3,15 @@ function b = check_file_extension(file,type) % Check file extension of a file. Returns 1 (true) if the extension of ```file``` is equal to % ```type```, 0 (false) otherwise. % -% INPUTS +% INPUTS % - file [str] file name. % - type [str] file extension. % -% OUTPUTS +% OUTPUTS % - b [bool] -% Copyright (C) 2012-2015 Dynare Team +% Copyright (C) 2012-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 diff --git a/src/utilities/from/from.m b/src/utilities/from/from.m index 81fd5bc1621a1af14cd6d239b3f6123c6f70c4d7..386cbba00f1e30c09723ae3fd696f58645979365 100644 --- a/src/utilities/from/from.m +++ b/src/utilities/from/from.m @@ -1,6 +1,6 @@ function from(varargin) % --*-- Unitary tests --*-- -% Copyright (C) 2014 Dynare Team +% Copyright (C) 2014-2017 Dynare Team % % This file is part of Dynare. % @@ -281,7 +281,7 @@ end % Put all the variables in a unique dseries object. list_of_variables = leadlagtable{1,1}; for i=2:number_of_variables - list_of_variables = [list_of_variables, ',' leadlagtable{i,1}]; + list_of_variables = [list_of_variables, ',' leadlagtable{i,1}]; end eval(sprintf('tmp = [%s];', list_of_variables)); @@ -376,52 +376,52 @@ else end function msg = get_error_message_0(msg) - if ~nargin - msg = sprintf('Wrong syntax! The correct syntax is:\n\n'); - 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.')]; +if ~nargin + msg = sprintf('Wrong syntax! The correct syntax is:\n\n'); +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.')]; 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) - i = 0; - return - end - if isequal('-',id(3)) - i = - str2num(id(4:end-1)); - else - i = str2num(id(4:end-1)); - end +if isequal('(t)',id) + i = 0; + return +end +if isequal('-',id(3)) + i = - str2num(id(4:end-1)); +else + i = str2num(id(4:end-1)); +end function id = num2index(i) - if isequal(i,0) - id = '(t)'; - return - end - if i<0 - id = ['(t-' int2str(abs(i)) ')']; - else - id = ['(t+' int2str(i) ')']; - end +if isequal(i,0) + id = '(t)'; + return +end +if i<0 + id = ['(t-' int2str(abs(i)) ')']; +else + id = ['(t+' int2str(i) ')']; +end function i = isassignedvariable(var,expr) - idv = strfind(expr,var); - idq = strfind(expr,'='); - if ~isempty(idv) - if idv(1)<idq - i = 1; - return - end +idv = strfind(expr,var); +idq = strfind(expr,'='); +if ~isempty(idv) + if idv(1)<idq + i = 1; + return end - i = 0; +end +i = 0; %@test:1 %$ try diff --git a/src/utilities/insert/insert_column_vector_in_a_matrix.m b/src/utilities/insert/insert_column_vector_in_a_matrix.m index 11884240161c4f9473bdacc0303774e3b2e1b9f0..b3d97c9947e5a99a1ab773efc323ae9bbe41d24d 100644 --- a/src/utilities/insert/insert_column_vector_in_a_matrix.m +++ b/src/utilities/insert/insert_column_vector_in_a_matrix.m @@ -2,15 +2,15 @@ function matrix = insert_column_vector_in_a_matrix(matrix, vector, i) % --*-- U % Inserts a vector in a matrix in a column specified by i. % -% INPUTS +% INPUTS % - matrix [float] n*m matrix. % - vector [float] n*1 vector. % - i [integer] scalar between 1 and m+1. Default value is m+1. % -% OUTPUTS +% OUTPUTS % - matrix [float] n*(m+1) matrix. -% Copyright (C) 2013-2015 Dynare Team +% Copyright (C) 2013-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 diff --git a/src/utilities/insert/insert_object_in_a_one_dimensional_cell_array.m b/src/utilities/insert/insert_object_in_a_one_dimensional_cell_array.m index c8ce6632fd6e6d5a82c3a13a7a04bdebf5284b24..11c3eff68c79a2d06e504085d497ba2b0c1d5a59 100644 --- a/src/utilities/insert/insert_object_in_a_one_dimensional_cell_array.m +++ b/src/utilities/insert/insert_object_in_a_one_dimensional_cell_array.m @@ -2,15 +2,15 @@ function one_dimensional_cell_array = insert_object_in_a_one_dimensional_cell_ar % Inserts an object in a one dimensional cell array in a position specified by i. % -% INPUTS +% INPUTS % - one_dimensional_cell_array [any] cell array with n objects. % - object [any] scalar object. % - i [integer] scalar between 1 and n+1. Default value is m+1. % -% OUTPUTS +% OUTPUTS % - one_dimensional_cell_array [any] cell array with n+1 elements. -% Copyright (C) 2013-2015 Dynare Team +% Copyright (C) 2013-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 diff --git a/src/utilities/insert/replace_object_in_a_one_dimensional_cell_array.m b/src/utilities/insert/replace_object_in_a_one_dimensional_cell_array.m index b5fcfff553733a3d996ddca09c9bc831df5223f8..05831b973c0ff9cad706ea0550693a5db1a8ca2d 100644 --- a/src/utilities/insert/replace_object_in_a_one_dimensional_cell_array.m +++ b/src/utilities/insert/replace_object_in_a_one_dimensional_cell_array.m @@ -2,15 +2,15 @@ function one_dimensional_cell_array = replace_object_in_a_one_dimensional_cell_a % Replaces an object in a one dimensional cell array in a position specified by i. % -% INPUTS +% INPUTS % - one_dimensional_cell_array [any] cell array with n objects. % - object [any] scalar object. % - i [integer] scalar between 1 and n. % -% OUTPUTS +% OUTPUTS % - one_dimensional_cell_array [any] cell array with n+1 elements. -% Copyright (C) 2013-2015 Dynare Team +% Copyright (C) 2013-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 diff --git a/src/utilities/is/is64bit.m b/src/utilities/is/is64bit.m index e2905a372e792d1a06700b292d37c91b5e710348..c1b688bb53939077b43178d63481080b0b59a0ee 100644 --- a/src/utilities/is/is64bit.m +++ b/src/utilities/is/is64bit.m @@ -17,5 +17,5 @@ function b = is64bit() % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. -[~, maxsize] = computer(); +[~, maxsize] = computer(); b = (maxsize > 2^31); \ No newline at end of file diff --git a/src/utilities/is/iscellofchar.m b/src/utilities/is/iscellofchar.m index a9100f61ca57a94d1a32642753a3d4d57ad1cfdb..0e8ff68e3e979534e3448008d49b0f6705051299 100644 --- a/src/utilities/is/iscellofchar.m +++ b/src/utilities/is/iscellofchar.m @@ -2,13 +2,13 @@ function a = iscellofchar(b) % Returns true iff ```b``` is a cell of char. % -% INPUTS +% INPUTS % - b [any] % -% OUTPUTS +% OUTPUTS % - a [bool] -% Copyright (C) 2012-2015 Dynare Team +% Copyright (C) 2012-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 diff --git a/src/utilities/is/isglobalinbase.m b/src/utilities/is/isglobalinbase.m index 8280ac610a04155d96fd4b0cec013697c6708431..e85b42aa99d534472935a38686e016127269bbe4 100644 --- a/src/utilities/is/isglobalinbase.m +++ b/src/utilities/is/isglobalinbase.m @@ -2,13 +2,13 @@ function a = isglobalinbase(var) % Returns true iff ```var``` is a global variable in the main workspace. % -% INPUTS +% INPUTS % - var [any] % -% OUTPUTS +% OUTPUTS % - a [bool] -% Copyright (C) 2013-2015 Dynare Team +% Copyright (C) 2013-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 diff --git a/src/utilities/missing/demean/demean.m b/src/utilities/missing/demean/demean.m index bcfa3b5dbfad4934c9561e00de77a09771f52186..a92a15cb8e7201c809961d332d3a78a60459a77c 100644 --- a/src/utilities/missing/demean/demean.m +++ b/src/utilities/missing/demean/demean.m @@ -2,13 +2,13 @@ function c = demean(x) % Removes the mean of each column of a matrix. % -% INPUTS +% INPUTS % - x [float] T*n matrix. % -% OUTPUTS +% OUTPUTS % - c [float] T*n matrix, the demeaned matrix x. -% Copyright (C) 2011-2015 Dynare Team +% Copyright (C) 2011-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 diff --git a/src/utilities/missing/get_file_extension/get_file_extension.m b/src/utilities/missing/get_file_extension/get_file_extension.m index 3951e8c3cb25b4e7a62d205968d797c9b930c8df..dad9ee0ac9157fbcde933064970cc98ae0e9a9bd 100644 --- a/src/utilities/missing/get_file_extension/get_file_extension.m +++ b/src/utilities/missing/get_file_extension/get_file_extension.m @@ -2,16 +2,16 @@ function ext = get_file_extension(file) % returns the extension of a file. % -% INPUTS +% INPUTS % o file string, name of the file % -% OUTPUTS +% OUTPUTS % o ext string, extension. % -% REMARKS +% REMARKS % If the provided file name has no extension, the routine will return an empty array. -% Copyright (C) 2013-2015 Dynare Team +% Copyright (C) 2013-2017 Dynare Team % % This file is part of Dynare. % diff --git a/src/utilities/missing/ndim/ndim.m b/src/utilities/missing/ndim/ndim.m index dc62e80d231b86bdef33ce6866ccea676b9561ec..0e182ed9d516ca1bb7e43f796938b2943b63183d 100644 --- a/src/utilities/missing/ndim/ndim.m +++ b/src/utilities/missing/ndim/ndim.m @@ -2,13 +2,13 @@ function n = ndim(x) % Returns the number of non singleton dimensions of a matlab array. % -% INPUTS +% INPUTS % - x [array] % -% OUTPUTS +% OUTPUTS % - n [integer] number of non singleton dimensions. -% Copyright (C) 2012-2015 Dynare Team +% Copyright (C) 2012-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 diff --git a/src/utilities/missing/sample_hp_filter/sample_hp_filter.m b/src/utilities/missing/sample_hp_filter/sample_hp_filter.m index 77dddb82ad59ca4b048ca13f0f16992cd7a2cbd1..12781564357e31e8dc6c08cb339f3e2c63cf25f3 100644 --- a/src/utilities/missing/sample_hp_filter/sample_hp_filter.m +++ b/src/utilities/missing/sample_hp_filter/sample_hp_filter.m @@ -2,15 +2,15 @@ function [hptrend,hpcycle] = sample_hp_filter(y,s) % HP filters a collection of time series. % -% INPUTS +% INPUTS % y [double] T*n matrix of data (n is the number of variables) % s [double] scalar, smoothing parameter. % -% OUTPUTS +% OUTPUTS % hptrend [double] T*n matrix, trend component of y. % hpcycle [double] T*n matrix, cycle component of y. -% Copyright (C) 2010-2015 Dynare Team +% Copyright (C) 2010-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 diff --git a/src/utilities/print/data2txt.m b/src/utilities/print/data2txt.m index 88c5569238fdfac494f7c80cd80ed069d8a420c1..80dc61559e78b859bdecec4f87fe2ef08088da5c 100644 --- a/src/utilities/print/data2txt.m +++ b/src/utilities/print/data2txt.m @@ -1,5 +1,5 @@ function str= data2txt(y) - + % Prints a one dimensional array. % Copyright (C) 2017 Dynare Team @@ -9,7 +9,7 @@ function str= data2txt(y) % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. diff --git a/src/utilities/str/common_strings_in_cell_arrays.m b/src/utilities/str/common_strings_in_cell_arrays.m index 724183fb37fafb52b689a21869cf637c807143b8..72baa92f6b9015f8aa991d3ba9b066ed334add8b 100644 --- a/src/utilities/str/common_strings_in_cell_arrays.m +++ b/src/utilities/str/common_strings_in_cell_arrays.m @@ -2,15 +2,15 @@ function [n,message] = common_strings_in_cell_arrays(a,b) % Counts the number of common strings in two cell arrays of strings ```a``` and ```b```. % -% INPUTS +% INPUTS % - a [cell] One dimensional cell array of strings. % - b [cell] One dimensional cell array of strings. % -% OUTPUTS +% OUTPUTS % - n [integer] scalar, the number of common strings. % - message [string] formatted list of common strings. -% Copyright (C) 2013-2015 Dynare Team +% Copyright (C) 2013-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 @@ -107,4 +107,3 @@ end %$ end %$ T = all(t); %@eof:3 - diff --git a/src/utilities/str/default_name.m b/src/utilities/str/default_name.m index 1711195c4313ddca8d499cd4d4b2f49f7cedb867..acb285195183bd366b3c93534a1fdb7af19813b3 100644 --- a/src/utilities/str/default_name.m +++ b/src/utilities/str/default_name.m @@ -1,6 +1,6 @@ function names = default_name(dim) -% Copyright (C) 2013 Dynare Team +% Copyright (C) 2013-2017 Dynare Team % % This file is part of Dynare. % @@ -17,11 +17,8 @@ function names = default_name(dim) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. - + names = {}; for i=1:dim names = vertcat(names, {['Variable_' int2str(i)]}); end - - - diff --git a/src/utilities/str/get_random_string.m b/src/utilities/str/get_random_string.m index 44a45f4aabaadbe56d3ed0ca49036c0cce248b12..29b9a4c07609e6cdb1e29be15bb95f36c58b083d 100644 --- a/src/utilities/str/get_random_string.m +++ b/src/utilities/str/get_random_string.m @@ -2,13 +2,13 @@ function s = get_random_string(n); % Builds a random string (starting with a letter). % -% INPUTS +% INPUTS % - n [integer] scalar, length of the generated string. % -% OUTPUTS +% OUTPUTS % - s [string] random string of length n. -% Copyright (C) 2012-2015 Dynare Team +% Copyright (C) 2012-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 diff --git a/src/utilities/str/name2tex.m b/src/utilities/str/name2tex.m index 3ce3575d97aa99ca7527fca635732a40ba6dcecb..12dadc59be64000758740b8e3c8474255aa923d8 100644 --- a/src/utilities/str/name2tex.m +++ b/src/utilities/str/name2tex.m @@ -4,14 +4,14 @@ function tex = name2tex(name, info) % --*-- Unitary tests --*-- % % Builds a random string (starting with a letter). % -% INPUTS +% INPUTS % - name [string or cell of strings] name(s) to be converted. % - info [integer] scalar equal to 0 or 1 (adds curly braces for indices). % -% OUTPUTS +% OUTPUTS % - tex [string or cell of strings] -% Copyright (C) 2012-2016 Dynare Team +% Copyright (C) 2012-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 diff --git a/src/utilities/variables/build_list_of_variables_with_loops.m b/src/utilities/variables/build_list_of_variables_with_loops.m index 47562091a92a070fe2f82e4e3dd7fb2784ae4858..a001c0beba71ce1eee2b722931e5377ab7cb2eff 100644 --- a/src/utilities/variables/build_list_of_variables_with_loops.m +++ b/src/utilities/variables/build_list_of_variables_with_loops.m @@ -1,6 +1,6 @@ function list_of_variables = build_list_of_variables_with_loops(o_list_of_variables, idArobase, VariableName, list_of_variables) -% Copyright (C) 2016 Dynare Team +% Copyright (C) 2016-2017 Dynare Team % % This file is part of Dynare. % @@ -18,7 +18,7 @@ function list_of_variables = build_list_of_variables_with_loops(o_list_of_variab % along with Dynare. If not, see <http://www.gnu.org/licenses/>. checknames = ~isempty(o_list_of_variables); - + NumberOfImplicitLoops = .5*length(idArobase); idComma = cell(NumberOfImplicitLoops,1); @@ -39,7 +39,7 @@ switch NumberOfImplicitLoops expression = expressions{1}; idVariables_ = []; while ~isempty(expression) - [token, expression] = strtok(expression,','); + [token, expression] = strtok(expression,','); candidate = [VariableName(1:idArobase(1)-1), token, VariableName(idArobase(2)+1:end)]; if checknames id = find(strcmp(candidate,o_list_of_variables)); diff --git a/src/utilities/variables/build_list_of_variables_with_regexp.m b/src/utilities/variables/build_list_of_variables_with_regexp.m index 90d76c93debbbd4481d1d96089f4f3f1ac843162..acf907b693d5e9f3b586cb00400679f2815a3f02 100644 --- a/src/utilities/variables/build_list_of_variables_with_regexp.m +++ b/src/utilities/variables/build_list_of_variables_with_regexp.m @@ -1,6 +1,6 @@ function list_of_variables = build_list_of_variables_with_regexp(o_list_of_variables, idBrackets, VariableName, list_of_variables) -% Copyright (C) 2016 Dynare Team +% Copyright (C) 2016-2017 Dynare Team % % This file is part of Dynare. % @@ -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) - for j = 1:CellArrayDimension(2) - b(i,j) = ~isempty(CellArray{i,j}); - end +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 diff --git a/src/utilities/x13/isoption.m b/src/utilities/x13/isoption.m index 588f76b1c1c743fd37333eb60c2e7019d5c21982..258ce583e506a7fbd44d51b0aef4e88e6faf6942 100644 --- a/src/utilities/x13/isoption.m +++ b/src/utilities/x13/isoption.m @@ -7,7 +7,7 @@ function b = isoption(command, option) % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. @@ -24,27 +24,27 @@ switch command 'hrinitial', 'reducecv', 'rejectfcst', 'urfinal'}); case 'regression' b = ismember(option, {'aicdiff', 'aictest', 'chi2test', 'chi2testcv', ... - 'print', 'save', 'pvaictest', 'savelog', 'start', ... - 'tlimit', 'user', 'usertype', 'variables', 'b', ... - 'centeruser', 'eastermeans', 'noapply', 'tcrate'}); + 'print', 'save', 'pvaictest', 'savelog', 'start', ... + 'tlimit', 'user', 'usertype', 'variables', 'b', ... + 'centeruser', 'eastermeans', 'noapply', 'tcrate'}); case 'transform' b = ismember(option, {'adjust', 'aicdiff', 'function', 'mode', 'name', ... - 'power', 'precision', 'print', 'save', 'savelog', ... - 'start', 'title', 'type'}); + 'power', 'precision', 'print', 'save', 'savelog', ... + 'start', 'title', 'type'}); case 'estimate' b = ismember(option, {'exact', 'maxiter', 'outofsample', 'print', 'save', 'savelog', 'tol', 'file', 'fix'}); case 'outlier' b = ismember(option, {'critical', 'lsrun', 'method', 'print', 'save', ... - 'savelog', 'span', 'types', 'almost', 'tcrate'}); + 'savelog', 'span', 'types', 'almost', 'tcrate'}); case 'forecast' b = ismember(option, {'exclude', 'lognormal', 'maxback', 'maxlead', 'print', 'save', 'probability'}); case 'check' b = ismember(option, {'maxlag', 'print', 'save', 'qtype', 'savelog'}); case 'x11' b = ismember(option, {'appendbcst', 'appendfcst', 'final', 'mode', 'print', 'save', ... - 'savelog', 'seasonalma', 'sigmalim', 'title', 'trendma', 'type', ... - 'calendarsigma', 'centerseasonal', 'keepholiday', 'print1stpass', ... - 'sfshort', 'sigmavec', 'trendic', 'true7term', 'excludefcst'}); + 'savelog', 'seasonalma', 'sigmalim', 'title', 'trendma', 'type', ... + 'calendarsigma', 'centerseasonal', 'keepholiday', 'print1stpass', ... + 'sfshort', 'sigmavec', 'trendic', 'true7term', 'excludefcst'}); otherwise error('x13:isoption: Unknown block!') end diff --git a/src/utilities/x13/printoption.m b/src/utilities/x13/printoption.m index 647b56c299ec327b6fd894c0a7126adaddecdf46..4e65e0db75a12f058bf33d0f26e23e2f79e835df 100644 --- a/src/utilities/x13/printoption.m +++ b/src/utilities/x13/printoption.m @@ -7,7 +7,7 @@ function printoption(fid, optname, optvalue) % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. diff --git a/src/utilities/x13/printspan.m b/src/utilities/x13/printspan.m index 94e41c58abfc73cfe8dbfa0f83ddbc374fb619ec..aceef2754413b28bafbc29e9dfce31f647fb3624 100644 --- a/src/utilities/x13/printspan.m +++ b/src/utilities/x13/printspan.m @@ -7,7 +7,7 @@ function printspan(fid, period1, period2) % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. @@ -19,7 +19,7 @@ if ~isequal(period1.freq, period2.freq) error('x13:printspan: Second and third input argument must have common frequency!') end -if ~ismember(period1.freq, [1 4 12]) || ~ismember(period2.freq, [1 4 12]) +if ~ismember(period1.freq, [1 4 12]) || ~ismember(period2.freq, [1 4 12]) error('x13:printspan: Only monthly, quaterly or annual data are allowed!') end diff --git a/src/utilities/x13/printstart.m b/src/utilities/x13/printstart.m index c13db9e4d422e2c1cc3501ed495a16dd9f86f774..43bfea56fc54fc78c333934f88bc0c77ae416aea 100644 --- a/src/utilities/x13/printstart.m +++ b/src/utilities/x13/printstart.m @@ -7,7 +7,7 @@ function printstart(fid, period) % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. diff --git a/src/utilities/x13/select_x13_binary.m b/src/utilities/x13/select_x13_binary.m index b753ed78c1a4300ad374b36d1402660a4ff4fc2c..07d33cb6907efdd5fc657d24330bd011f9589599 100644 --- a/src/utilities/x13/select_x13_binary.m +++ b/src/utilities/x13/select_x13_binary.m @@ -1,5 +1,5 @@ function x13_binary = select_x13_binary() - + % Copyright (C) 2017 Dynare Team % % This code is free software: you can redistribute it and/or modify @@ -7,7 +7,7 @@ function x13_binary = select_x13_binary() % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. @@ -31,7 +31,7 @@ elseif ispc() x13_binary = sprintf('%s%s%s%s', x13_binary, '64', filesep(), 'x13.exe'); else x13_binary = sprintf('%s%s%s%s', x13_binary, '32', filesep(), 'x13.exe'); - end + end else error('X13 binary is not yet available for this plateform') end \ No newline at end of file diff --git a/src/utilities/x13/setdefaultmember.m b/src/utilities/x13/setdefaultmember.m index 0556012a42bbd88a70bc62919ffcf069114ca48c..f75ddb05e012b228f6d298322d553e835627f44b 100644 --- a/src/utilities/x13/setdefaultmember.m +++ b/src/utilities/x13/setdefaultmember.m @@ -9,7 +9,7 @@ function s = setdefaultmember(name) % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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,8 +22,8 @@ switch name 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', []); + 'mixed', [], 'print', [], 'savelog', [], 'armalimit', [], 'balanced', [], 'exactdiff', [], 'fcstlim', [], ... + 'hrinitial', [], 'reducecv', [], 'rejectfcst', [], 'urfinal', []); case 'regression' s = struct('aicdiff', [], 'aictest', [], 'chi2test', [], 'chi2testcv', [], ... 'print', [], 'save', [], 'pvaictest', [], 'savelog', [], 'start', [], ... diff --git a/src/utilities/x13/setoption.m b/src/utilities/x13/setoption.m index 32bd99dbe2dbb77e23d41751fa75f7f165bbf573..aa04f91deaee43400a36ef8f9eb979d67996fb78 100644 --- a/src/utilities/x13/setoption.m +++ b/src/utilities/x13/setoption.m @@ -7,7 +7,7 @@ function command = setoption(command, optname, optvalue) % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % -% Dynare dates submodule 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. @@ -20,4 +20,3 @@ if isfield(command, optname) else disp(sprintf('Option %s is unknown!', optname)) end - diff --git a/tests/fake/printf.m b/tests/fake/printf.m index f4862f4f9f849cb4a586cf87ff793fc6dd0ccfe0..0af9716fc6a622770436fedc114190e8a1f8da1f 100644 --- a/tests/fake/printf.m +++ b/tests/fake/printf.m @@ -1,3 +1,18 @@ +% Copyright (C) 2015-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/>. + function printf(varargin) % Do nothing end \ No newline at end of file diff --git a/tests/runalltests.m b/tests/runalltests.m index b207af3af7a359a7c2b632b077c971f6784402f3..5ca0fb1b4646a8645a4a4da5c9e84861a3a4835c 100644 --- a/tests/runalltests.m +++ b/tests/runalltests.m @@ -1,3 +1,18 @@ +% Copyright (C) 2015-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/>. + opath = path(); system('rm -f failed');