Attachment 'DetrendDataSet.m'

Download

   1 function [Data,Tendance] = DetrendDataSet(Data,PolyOrder,VarLog,info)
   2 % stephane.adjemian@ens.fr [03-09-2006]
   3 
   4 T = size(Data,1);
   5 k = size(Data,2);
   6 
   7 if nargin <= 1
   8   PolyOrder = 1;
   9   VarLog = [];
  10 end
  11 if nargin <= 2
  12   VarLog = [];
  13 end
  14 
  15 if nargin <=3
  16   info = 0;
  17 end  
  18 
  19 if ~isempty(VarLog)  
  20   Data(:,VarLog) = log(Data(:,VarLog));  
  21 end
  22 
  23 X = zeros(T,PolyOrder+1);
  24 order = 0;
  25 while order <= PolyOrder
  26   X(:,order+1) = transpose(1:T).^order;
  27   order = order+1;
  28 end
  29 Y = Data(:,1);
  30 Ahat = inv(X'*X)*X'*Y;
  31 Resids = Y-X*Ahat;
  32 Data(:,1) = Resids;
  33 if k>= 2
  34   Data(:,2:k) = Data(:,2:k)-X(:,2:PolyOrder+1)*Ahat(2:PolyOrder+1);
  35   Data(:,2:k) = Data(:,2:k)-kron(mean(Data(:,2:k)),ones(T,1));
  36 end
  37 Tendance = exp(X*Ahat);

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-10-06 18:41:43, 50.3 KB) [[attachment:AWM update 9.pdf]]
  • [get | view] (2008-10-31 11:19:36, 119.4 KB) [[attachment:AWM15UP8.CSV]]
  • [get | view] (2009-10-06 18:41:26, 178.3 KB) [[attachment:AWM16UP9.CSV]]
  • [get | view] (2008-10-31 11:20:50, 50.2 KB) [[attachment:AWMupdate8.pdf]]
  • [get | view] (2008-10-24 18:18:48, 87.0 KB) [[attachment:Base.xls]]
  • [get | view] (2008-10-24 18:19:14, 696.5 KB) [[attachment:BaseRetrop.xls]]
  • [get | view] (2008-10-24 18:27:07, 0.7 KB) [[attachment:DetrendDataSet.m]]
  • [get | view] (2008-10-24 18:26:55, 0.9 KB) [[attachment:MakeData2.m]]
  • [get | view] (2008-10-24 18:25:41, 76.0 KB) [[attachment:amazone.xls]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.