summaryrefslogtreecommitdiff
path: root/2048/DEPENDENCIES/pacf_mat.sci
blob: ba250b63f9f6a23fe0d83f024966231a95958524 (plain)
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
// Construction of square matrix required to compute PACF ajj, useful for the calculations in Sec. 6.4.5.
// 6.11

function ajj = pacf_mat(rvv0,rvv_rest,p,k)
if argn(2) == 3,
  k = 1;
end
for i = 1:p
  for j = 1:p
    index = (k+i-1)-j;
    if index == 0, 
      A(i,j) = rvv0;
    elseif index < 0,
      A(i,j) = rvv_rest(-index);
    else 
      A(i,j) = rvv_rest(index);
    end
  end
  b(i) = -rvv_rest(k+i-1);
end
a = A\b;
ajj = a(p);
endfunction;