A frequency distribution for two variables Cross Tabs A frequency distribution for two variables
M&Ms Color Distribution % according to their website Brown Yellow Red Blue Orange Green Plain 13 14 24 20 16 Peanut 12 15 23
We take a sample of M&M’s and find a sample distribution to compare to the website distribution
My M&Ms data in counts 14 10 8 4 54 2 3 5 22 16 13 15 12 76 Brown Yellow Red Blue Orange Green Total Plain 14 10 8 4 54 Peanut 2 3 5 22 16 13 15 12 76
14 of the 76 M&M’s were plain brown M&M’s Yellow Red Blue Orange Green Total Plain 14 10 8 4 54 Peanut 2 3 5 22 16 13 15 12 76 14 of the 76 M&M’s were plain brown M&M’s
Brown Yellow Red Blue Orange Green Total Plain 14 10 8 4 54 Peanut 2 3 5 22 16 13 15 12 76 54 of the 76 M&M’s were Plain
8 of the 76 M&M’s were blue 14 10 8 4 54 2 3 5 22 16 13 15 12 76 Brown Yellow Red Blue Orange Green Total Plain 14 10 8 4 54 Peanut 2 3 5 22 16 13 15 12 76 8 of the 76 M&M’s were blue
Probability To find the probability: N(event)/N(total) P(peanut green M&M) = N(Peanut Green)/N(Total M&M’s)
To find Joint Distribution, we find the probabilities of each cell by dividing by the total (76) Brown Yellow Red Blue Orange Green Total Plain 14/76 10/76 8/76 4/76 54/76 Peanut 2/76 3/76 5/76 0/76 22/76 16/76 13/76 15/76 12/76 76
My M&Ms data: With Marginal Distributions Brown Yellow Red Blue Orange Green Marg. for flavor Plain 18.4 13.2 10.5 5.3 71.1 Peanut 2.6 3.9 6.6 28.9 Marg. for color 21.0 17.1 19.8 15.8 100
Knowing that the M&M is green, what is the probability it was Peanut? Brown Yellow Red Blue Orange Green Total Plain 14 10 8 4 54 Peanut 2 3 5 22 16 13 15 12 76 We can focus on just the green column so the probability of Peanut is: N(Green Peanut)/N(Green) = 4/12
Conditional distribution of flavor for color We know the color of our M&M already, but now how is flavor distributed for this color?
Knowing that the M&M is Plain, what is the probability it is Yellow? Brown Yellow Red Blue Orange Green Total Plain 14 10 8 4 54 Peanut 2 3 5 22 16 13 15 12 76 We can focus on just the Plain row so the probability of Yellow is: N(Yellow Plain)/N(Plain) = 10/54
Conditional distribution of color for flavor We know the flavor of our M&M already, but now how is color distributed for this color?
Conditional distributions in general Conditional distribution of X for Y (we know Y for sure already, but we want to know the probability or % of having X be true as well):
Bar graphs for conditional distribution of color for both flavors
Joint Distribution (In white boxes) Marginal (In gray boxed) Conditional (Given color or flavor) Brown Yellow Red Blue Orange Green Marg. for flavor Plain 18.4 13.2 10.5 5.3 71.1 Peanut 2.6 3.9 6.6 28.9 Marg. for color 21.0 17.1 19.8 15.8 100