/usr/share/octave/packages/tsa-4.2.7/pacf.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 | function [PARCOR,sig,cil,ciu]= pacf(Z,KMAX);
% Partial Autocorrelation function
% [parcor,sig,cil,ciu] = pacf(Z,N);
%
% Input:
% Z Signal, each row is analysed
% N # of coefficients
% Output:
% parcor autocorrelation function
% sig p-value for significance test
% cil lower confidence interval
% ciu upper confidence interval
%
% see also: DURLEV, LATTICE, AC2RC, AR2RC,
% FLAG_IMPLICIT_SIGNIFICANCE
% $Id: pacf.m 11693 2013-03-04 06:40:14Z schloegl $
% Copyright (C) 1997-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);
if nc<KMAX,
warning('too less elements.\nmake sure the data is row order\n')
end;
[s,n] = sumskipnan(Z,2);
Z = Z - repmat(s./n,1,nc); % remove mean
if (nargin == 1), KMAX = N-1; end;
AutoCov = acovf(Z,KMAX);
[AR,PARCOR,PE] = durlev(AutoCov); % PARCOR are the reflection coefficients
%[AR,PARCOR,PE] = lattice(Z,KMAX); % PARCOR are the reflection coefficients
PARCOR = -PARCOR; % the partial correlation coefficients are the negative reflection coefficient.
if nargout<2, return, end;
% significance test
s = 1./sqrt(repmat(n,1,KMAX)-1-ones(nr,1)*(1:KMAX));
sig = normcdf(PARCOR,0,s);
sig = min(sig,1-sig);
if nargout<3, return, end;
% calculate confidence interval
if exist('flag_implicit_significance')==2;
alpha = flag_implicit_significance;
else
alpha = 0.05;
end;
fprintf(1,'PACF: confidence interval for alpha=%f\n', alpha);
ciu = norminv(alpha/2).*s;
cil = -ciu;
|