This file is indexed.

/usr/share/octave/packages/3.2/tsa-4.1.0/acorf.m is in octave-tsa 4.1.0+svn20110501-1.

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
function [AUTOCOV,stderr,lpq,qpval] = acorf(Z,N);
%  Calculates autocorrelations for multiple data series.
%  Missing values in Z (NaN) are considered. 
%  Also calculates Ljung-Box Q stats and p-values.
%
%    [AutoCorr,stderr,lpq,qpval] = acorf(Z,N);
%  If mean should be removed use
%    [AutoCorr,stderr,lpq,qpval] = acorf(detrend(Z',0)',N);
%  If trend should be removed use
%    [AutoCorr,stderr,lpq,qpval] = acorf(detrend(Z')',N);
%
% INPUT
%  Z	is data series for which autocorrelations are required
%       each in a row
%  N	maximum lag
%
% OUTPUT
%  AutoCorr nr x N matrix of autocorrelations
%  stderr   nr x N matrix of (approx) std errors
%  lpq      nr x M matrix of Ljung-Box Q stats
%  qpval    nr x N matrix of p-values on Q stats
%   
% All input and output parameters are organized in rows, one row 
% corresponds to one series
%
% REFERENCES:
%  S. Haykin "Adaptive Filter Theory" 3ed. Prentice Hall, 1996.
%  M.B. Priestley "Spectral Analysis and Time Series" Academic Press, 1981. 
%  W.S. Wei "Time Series Analysis" Addison Wesley, 1990.
%  J.S. Bendat and A.G.Persol "Random Data: Analysis and Measurement procedures", Wiley, 1986.

% calculating lpq, stderr, qpval from 
% suggested by Philip Gray, University of New South Wales, 

%       $Id: acorf.m 5090 2008-06-05 08:12:04Z schloegl $
%       Copyright (C) 1998-2002,2008 by Alois Schloegl <a.schloegl@ieee.org>
%
%    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/>.


[nr,nc] = size(Z);
NC = sum(~isnan(Z),2); % missing values

AUTOCOV = acovf(Z,N);
AUTOCOV = AUTOCOV(:,2:N+1) ./ AUTOCOV(:,ones(1,N));

if nargout > 1 
        stderr = sqrt(1./NC)*ones(1,N);
        lpq = zeros(nr,N);
        qpval = zeros(nr,N);
        
        cum=zeros(nr,1);
        for k=1:N,
                cum = cum+AUTOCOV(:,k).*conj(AUTOCOV(:,k))./(NC-k);
                lpq(:,k) = NC.*(NC+2).*cum;                 % Ljung box Q for k lags
                %qpval(:,k) = 1 - chi2cdf(lpq(:,k),k);	% p-value of Q stat
                qpval(:,k) = 1 - gammainc(lpq(:,k)/2,k/2);	% replace chi2cdf by gammainc
        end;
end;