


STAND_ Standardise a matrix by columns [x,my,sy]=stand(y) y: Time series (column matrix) x: standardised equivalent of y my: Vector of mean values for each column of y sy: Vector of standard deviations for each column of y Author : Marco Ratto


0001 function [y, meany, stdy] = stand_(x) 0002 % STAND_ Standardise a matrix by columns 0003 % 0004 % [x,my,sy]=stand(y) 0005 % 0006 % y: Time series (column matrix) 0007 % 0008 % x: standardised equivalent of y 0009 % my: Vector of mean values for each column of y 0010 % sy: Vector of standard deviations for each column of y 0011 % 0012 % Author : Marco Ratto 0013 0014 % Copyright (C) 2012 Dynare Team 0015 % 0016 % This file is part of Dynare. 0017 % 0018 % Dynare is free software: you can redistribute it and/or modify 0019 % it under the terms of the GNU General Public License as published by 0020 % the Free Software Foundation, either version 3 of the License, or 0021 % (at your option) any later version. 0022 % 0023 % Dynare is distributed in the hope that it will be useful, 0024 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0026 % GNU General Public License for more details. 0027 % 0028 % You should have received a copy of the GNU General Public License 0029 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0030 0031 if nargin==0, 0032 return; 0033 end 0034 0035 for j=1:size(x,2); 0036 meany(j)=mean(x(find(~isnan(x(:,j))),j)); 0037 stdy(j)=std(x(find(~isnan(x(:,j))),j)); 0038 y(:,j)=(x(:,j)-meany(j))./stdy(j); 0039 end 0040 % end of m-file