## Diff of /inst/quotapanning.m[88c2a4] .. [677636]  Maximize  Restore

### Switch to unified view

a/inst/quotapanning.m b/inst/quotapanning.m
`...`
`...`
53
```## @seealso {bferguson, ultimatepanning, quotald, quotaad, quotamack}
```
53
```## @seealso {bferguson, ultimatepanning, quotald, quotaad, quotamack}
```
54
```## @end deftypefn
```
54
```## @end deftypefn
```
55
55
56
```function quotas = quotapanning (S)
```
56
```function quotas = quotapanning (S)
```
57
57
58
```[m,n] = size (S);           #triangle with m years (i=1,2,u,...u+1,u+2,....m) and n periods (k=0,1,2,...n-1)
```
58
```  [m,n] = size (S);           #triangle with m years (i=1,2,u,...u+1,u+2,....m) and n periods (k=0,1,2,...n-1)
```
59
```u = m - n;                                     #rows of the upper square
```
59
```  u = m - n;                                     #rows of the upper square
```
60
```S = fliplr(triu(fliplr(S),-u));                   #ensure S is triangular
```
60
```  S = fliplr(triu(fliplr(S),-u));                   #ensure S is triangular
```
61
61
62
```# calculate Z
```
62
```  # calculate Z
```
63
```Z = [S(:,1), S(:,2:n)-S(:,1:n-1)];
```
63
```  Z = [S(:,1), S(:,2:n)-S(:,1:n-1)];
```
64
```Z = fliplr(triu(fliplr(Z),-u));        #clean Z
```
64
```  Z = fliplr(triu(fliplr(Z),-u));        #clean Z
```
65
65
66
```# calc empirical values of the incremental factors
```
66
```  # calc empirical values of the incremental factors
```
67
```B = Z ./ (Z * [ones(n,1),zeros(n,n-1)]');
```
67
```  B = Z ./ (Z * [ones(n,1),zeros(n,n-1)]');
```
68
```
```
69
```# weights Z(i,0)^2/Z(0)^2
```
70
``` W = repmat((Z(:,1).^2),1,n);          #numerator
```
71
``` W =fliplr(triu(fliplr(W),-u));        #clean low triangle
```
72
``` a = repmat(sum(W),m,1);               #denominator
```
73
``` a = fliplr(triu(fliplr(a),-u));       #clean low triangle
```
74
``` W = W./a; #divido
```
75
``` W = fliplr(triu(fliplr(W),-u));       #clean low triangle
```
76
68
69
```  # weights Z(i,0)^2/Z(0)^2
```
70
```   W = repmat((Z(:,1).^2),1,n);          #numerator
```
71
```   W =fliplr(triu(fliplr(W),-u));        #clean low triangle
```
72
```   a = repmat(sum(W),m,1);               #denominator
```
73
```   a = fliplr(triu(fliplr(a),-u));       #clean low triangle
```
74
```   W = W./a; #divido
```
75
```   W = fliplr(triu(fliplr(W),-u));       #clean low triangle
```
76
77
```# Pannings incremental factors
```
77
```  # Pannings incremental factors
```
78
```B_Pan  = diag(B' * W)';                #weighted product
```
78
```  B_Pan  = diag(B' * W)';                #weighted product
```
79
```quotas = cumsum(porcentual(B_Pan));    #cumulated quota
```
79
```  quotas = cumsum(porcentual(B_Pan));    #cumulated quota
```
80
```
```
80
81
```end
```
81
```end
```