/usr/share/octave/packages/tsa-4.2.7/selmo2.m is in octave-tsa 4.2.7-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | function X = selmo2(y,Pmax);
% SELMO2 - model order selection for univariate and multivariate
% autoregressive models
%
% X = selmo(y,Pmax);
%
% y data series
% Pmax maximum model order
% X.A, X.B, X.C parameters of AR model
% X.OPT... various optimization criteria
%
% see also: SELMO, MVAR,
% $Id: selmo2.m 11693 2013-03-04 06:40:14Z schloegl $
% Copyright (C) 2007 by Alois Schloegl <a.schloegl@ieee.org>
% This is part of the TSA-toolbox. See also
% http://pub.ist.ac.at/~schloegl/matlab/tsa/
% http://octave.sourceforge.net/
% http://biosig.sourceforge.net/
%
% This program 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.
%
% This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
[M,N]=size(y);
if M>N,
y=y';
end;
[M,N]=size(y);
% Univariate AR
[AutoCov, AutoCorr, ARPMX, E, NC] = invest0(y,Pmax);
[FPE,AIC,BIC,SBC,MDL,CATcrit,PHI,optFPE,optAIC,optBIC,optSBC,optMDL,optCAT,optPHI,s,C] = selmo(E,NC);
% AIC for MVAR model
[AR,RC,PE] = mvar(y',Pmax);
E2 = repmat(NaN,1,Pmax);
for k = 0:Pmax,
S = PE(:,k*M+(1:M));
E2(k+1) = trace(S);
%%%% FIX ME %%%%% this does not seem right because it depends on the scaling of y
AIC_MV(k+1) = 2*log(det(S))+2*k*M*M/N; % Ding et al. 2000 refering to Akaike 1974
end;
X.A = [eye(M),-AR];
X.B = eye(M);
X.C = S;
X.datatype = 'MVAR';
X.MV.AIC = AIC_MV;
X.UV.FPE = FPE;
X.UV.AIC = AIC;
X.UV.BIC = BIC;
X.UV.MDL = MDL;
X.UV.CAT = CATcrit;
X.UV.PHI = PHI;
X.OPT.FPE = optFPE;
X.OPT.AIC = optAIC;
X.OPT.BIC = optBIC;
X.OPT.MDL = optMDL;
X.OPT.CAT = optCAT;
X.OPT.PHI = optPHI;
[tmp,X.OPT.MVAIC] = min(AIC_MV);
|