-
Notifications
You must be signed in to change notification settings - Fork 0
/
dhawAgeMat.m
43 lines (41 loc) · 1.98 KB
/
dhawAgeMat.m
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
function f=dhawAgeMat
age15=[1.92 0.65 0.41 0.24 0.46 0.73 0.67 0.83 0.24 0.22 0.36 0.2 0.2 0.26 0.13;
0.95 6.64 1.09 0.73 0.61 0.75 0.95 1.39 0.9 0.16 0.3 0.22 0.5 0.48 0.2;
0.48 1.31 6.85 1.52 0.27 0.31 0.48 0.76 1 0.69 0.32 0.44 0.27 0.41 0.33;
0.33 0.34 1.03 6.71 1.58 0.73 0.42 0.56 0.85 1.16 0.7 0.3 0.2 0.48 0.63;
0.45 0.3 0.22 0.93 2.59 1.49 0.75 0.63 0.77 0.87 0.88 0.61 0.53 0.37 0.33;
0.79 0.66 0.44 0.74 1.29 1.83 0.97 0.71 0.74 0.85 0.88 0.87 0.67 0.74 0.33;
0.97 1.07 0.62 0.5 0.88 1.19 1.67 0.89 1.02 0.91 0.92 0.61 0.76 0.63 0.27;
1.02 0.98 1.26 1.09 0.76 0.95 1.53 1.5 1.32 1.09 0.83 0.69 1.02 0.96 0.2;
0.55 1 1.14 0.94 0.73 0.88 0.82 1.23 1.35 1.27 0.89 0.67 0.94 0.81 0.8;
0.29 0.54 0.57 0.77 0.97 0.93 0.57 0.8 1.32 1.87 0.61 0.8 0.61 0.59 0.57;
0.33 0.38 0.4 0.41 0.44 0.85 0.6 0.61 0.71 0.95 0.74 1.06 0.59 0.56 0.57;
0.31 0.21 0.25 0.33 0.39 0.53 0.68 0.53 0.55 0.51 0.82 1.17 0.85 0.85 0.33;
0.26 0.25 0.19 0.24 0.19 0.34 0.4 0.39 0.47 0.55 0.41 0.78 0.65 0.85 0.57;
0.09 0.11 0.12 0.2 0.19 0.22 0.13 0.3 0.23 0.13 0.21 0.28 0.36 0.7 0.6;
0.14 0.15 0.21 0.1 0.24 0.17 0.15 0.41 0.5 0.71 0.53 0.76 0.47 0.74 1.47];
tmp1=[0.0568 0.0939 0.605 0.0597 0.1008 0.592 0.0641 0.1008 0.636 0.0656 0.1038 0.632 0.0642 0.0583 1.101 0.0616 0.0583 1.056 0.0703 0.0593 1.186 0.0777 0.0692 1.124 0.0759 0.0613 1.239 0.0665 0.0543 1.224 0.0614 0.0652 0.942 0.0648 0.0534 1.215 0.0511 0.0652 0.784 0.045 0.0267 1.688 0.1152 0.0296 3.887];
tmp2=reshape(tmp1,3,length(tmp1)/3);
%Select numbers wrt census
ageProps=tmp2(1,:);
%Sums to .9999 - leave it
aggInds={1,2:4,5:10,11:13,14:15};
groups=(1:5)';
lengths=[1,3,6,3,2]';
whichGroup=repelem(groups,lengths);
nbar=length(aggInds);
C=zeros(nbar,nbar);
props=zeros(length(age15),1);
for i=1:nbar
ai=aggInds{i};
propsi=ageProps(ai);
propsi=propsi./sum(propsi);
props(ai)=propsi;
end
for i=1:nbar
ai=aggInds{i};
Xi=age15(:,ai);
Xi=sum(Xi,2).*props;
C(:,i)=accumarray(whichGroup,Xi);%./lengths;
end
f=C;