<< Chapter < Page Chapter >> Page >

We utilize the ratio form of Bayes' rule to calculate the posterior odds

P ( G 1 | E ) P ( G 2 | E ) = P ( E | G 1 ) P ( E | G 2 ) · P ( G 1 ) P ( G 2 )

If the ratio is greater than one, classify in group 1; otherwise classify in group 2 (we assume that a ratio exactly one is so unlikely that we can neglect it). Because ofconditional independence, we are able to determine the conditional probabilities

P ( E | G 1 ) = 42 · 27 · 15 · 44 · 22 · 15 · 52 · 3 · 48 · 12 69 10 and
P ( E | G 2 ) = 29 · 37 · 33 · 18 · 23 · 5 · 17 · 5 · 24 · 5 56 10

The odds P ( G 1 ) / P ( G 2 ) = 69 / 56 . We find the posterior odds to be

P ( G 1 | E ) P ( G 2 | E ) = 42 · 27 · 15 · 44 · 22 · 15 · 52 · 3 · 48 · 12 29 · 37 · 33 · 18 · 23 · 5 · 17 · 5 · 24 · 5 · 56 9 69 9 = 5 . 85

The factor 56 9 / 69 9 comes from multiplying 56 10 / 69 10 by the odds P ( G 1 ) / P ( G 2 ) = 69 / 56 . Since the resulting posterior odds favoring Group 1 is greater than one, we classify the respondent in group 1.

While the calculations are simple and straightforward, they are tedious and error prone. To make possible rapid and easy solution, say in a situation where successive interviews areunderway, we have several m-procedures for performing the calculations. Answers to the questions would normally be designated by some such designation as Y for yes, N forno, and U for uncertain. In order for the m-procedure to work, these answers must be represented by numbers indicating the appropriate columns in matrices A and B . Thus, in the example under consideration, each Y must be translated into a 1, each N into a 2, and eachU into a 3. The task is not particularly difficult, but it is much easier to have MATLAB make the translation as well as do the calculations.The following two-stage approach for solving the problem works well.

The first m-procedure oddsdf sets up the frequency information. The next m-procedure odds calculates the odds for a given profile. The advantage of splitting into two m-procedures is that we can set up the data once, then callrepeatedly for the calculations for different profiles. As always, it is necessary to have the data in an appropriate form. The following is an example in which thedata are entered in terms of actual frequencies of response.

% file oddsf4.m % Frequency data for classificationA = [42 22 5; 34 27 8; 15 45 9; 19 44 6; 22 43 4;      41 13 15; 9 52 8; 40 26 3; 48 12 9; 20 37 12]; B = [20 31 5; 16 37 3; 33 19 4; 31 18 7; 23 28 5;     14 37 5; 31 17 8; 13 38 5; 27 24 5; 35 16 5];disp('Call for oddsdf')

Classification using frequency data

oddsf4              % Call for data in file oddsf4.m Call for oddsdf     % Prompt built into data fileoddsdf              % Call for m-procedure oddsdf Enter matrix A of frequencies for calibration group 1  AEnter matrix B of frequencies for calibration group 2  B Number of questions = 10Answers per question = 3  Enter code for answers and call for procedure "odds"y = 1;              % Use of lower case for easier writing n = 2;u = 3; odds                % Call for calculating procedureEnter profile matrix E  [y n y n y u n u y u]   % First profileOdds favoring Group 1:   5.845 Classify in Group 1odds                % Second call for calculating procedure Enter profile matrix E  [n n u n y y u n n y]   % Second profile Odds favoring Group 1:   0.2383Classify in Group 2 odds                % Third call for calculating procedureEnter profile matrix E  [y y n y u u n n y y]   % Third profileOdds favoring Group 1:   5.05 Classify in Group 1

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Applied probability. OpenStax CNX. Aug 31, 2009 Download for free at http://cnx.org/content/col10708/1.6
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Applied probability' conversation and receive update notifications?

Ask