<< Chapter < Page | Chapter >> Page > |
The principal feature of the m-procedure odds is the scheme for selecting the numbers from the A and B matrices. If , then the coding translates this into the actual numerical matrix
used internally. Then is a matrix with columns corresponding to elements of E . Thus
e = A(:,E)
e = 42 42 22 42 5 5 22 22 42 42 34 34 27 34 8 8 27 27 34 34
15 15 45 15 9 9 45 45 15 15 19 19 44 19 6 6 44 44 19 19
22 22 43 22 4 4 43 43 22 22 41 41 13 41 15 15 13 13 41 41
9 9 52 9 8 8 52 52 9 9 40 40 26 40 3 3 26 26 40 40
48 48 12 48 9 9 12 12 48 48 20 20 37 20 12 12 37 37 20 20
The i th entry on the i th column is the count corresponding to the answer to the i th question. For example, the answer to the third question is N (no), and the corresponding count is the third entry in the N (second) column of A . The element on the diagonal in the third column of is the third element in that column, and hence the desired third entry of the N column. Bypicking out the elements on the diagonal by the command diag(A(:,E)), we have the desired set of counts corresponding to the profile. The same is true for diag(B(:,E)).
Sometimes the data are given in terms of conditional probabilities and probabilities. A slight modification of the procedure handles thiscase. For purposes of comparison, we convert the problem above to this form by converting the counts in matrices A and B to conditional probabilities. We do this by dividing by the total count in each group (69 and 56 in this case). Also, and .
GROUP 1 | GROUP 2 | |||||
---|---|---|---|---|---|---|
Q | Yes | No | Unc. | Yes | No | Unc. |
1 | 0.6087 | 0.3188 | 0.0725 | 0.3571 | 0.5536 | 0.0893 |
2 | 0.4928 | 0.3913 | 0.1159 | 0.2857 | 0.6607 | 0.0536 |
3 | 0.2174 | 0.6522 | 0.1304 | 0.5893 | 0.3393 | 0.0714 |
4 | 0.2754 | 0.6376 | 0.0870 | 0.5536 | 0.3214 | 0.1250 |
5 | 0.3188 | 0.6232 | 0.0580 | 0.4107 | 0.5000 | 0.0893 |
6 | 0.5942 | 0.1884 | 0.2174 | 0.2500 | 0.6607 | 0.0893 |
7 | 0.1304 | 0.7536 | 0.1160 | 0.5536 | 0.3036 | 0.1428 |
8 | 0.5797 | 0.3768 | 0.0435 | 0.2321 | 0.6786 | 0.0893 |
9 | 0.6957 | 0.1739 | 0.1304 | 0.4821 | 0.4286 | 0.0893 |
10 | 0.2899 | 0.5362 | 0.1739 | 0.6250 | 0.2857 | 0.0893 |
These data are in an m-file oddsp4.m . The modified setup m-procedure oddsdp uses the conditional probabilities, then calls for the m-procedure odds.
oddsp4 % Call for converted data (probabilities)
oddsdp % Setup m-procedure for probabilitiesEnter conditional probabilities for Group 1 A
Enter conditional probabilities for Group 2 BProbability p1 individual is from Group 1 0.552
Number of questions = 10 Answers per question = 3
Enter code for answers and call for procedure "odds"y = 1;
n = 2;u = 3;
oddsEnter profile matrix E [y n y n y u n u y u]
Odds favoring Group 1: 5.845Classify in Group 1
The slight discrepancy in the odds favoring Group 1 (5.8454 compared with 5.8452) can be attributed to rounding of the conditional probabilities to four places. Thepresentation above rounds the results to 5.845 in each case, so the discrepancy is not apparent. This is quite acceptable, since the discrepancy has no effect on the results.
Notification Switch
Would you like to follow the 'Applied probability' conversation and receive update notifications?