# Goodness of fit

#### HikariT

##### New Member
Hey guys,
I you help me with this problem?

A school wanted to test whether 5 different soda drinks are equally popular among students. During the course of a day, the 5 soda's "sales" were recorded:
Sprite | Coke | Fanta | Rootbeer | Pepsi
22 | 24 | 12 | 15 | 30
The question tells me to find the test statististic for the appropriate goodness of fit test.

I know I have to do the "multiple comparisons" one, but I don't know how to exactly do that since don't they usually have two data rows?

#### Dragan

##### Super Moderator
Hey guys,
I you help me with this problem?

A school wanted to test whether 5 different soda drinks are equally popular among students. During the course of a day, the 5 soda's "sales" were recorded:
Sprite | Coke | Fanta | Rootbeer | Pepsi
22 | 24 | 12 | 15 | 30
The question tells me to find the test statististic for the appropriate goodness of fit test.

I know I have to do the "multiple comparisons" one, but I don't know how to exactly do that since don't they usually have two data rows?

In this case, the appropriate test is a chi-square goodness of fit test.

Chi-square (X^2) = Sum ( (O - E)^2 / E )

where the O's are the observed data and E's are the expected frequencies under uniformity E = 103/5 = 20.6 .

The critical values is (alpha = 0.05, df = 4) is 9.48773.

If your calculated value of X^2 exceeds the critical value then reject the null hypothesis that selections were (equally) uniformily distributed.

Mkay.

#### HikariT

##### New Member
I kinda understand the formula and how to calculate it, but the thing I couldn't do was find the expected values. For some reason, whenever I tried doing it, I got the expected values to be the same as the observed. Can you tell me how to do it correctly? Thanks again

#### Mean Joe

##### TS Contributor
I kinda understand the formula and how to calculate it, but the thing I couldn't do was find the expected values. For some reason, whenever I tried doing it, I got the expected values to be the same as the observed. Can you tell me how to do it correctly? Thanks again
You "wanted to test whether 5 different soda drinks are equally popular".

If the soda drinks are equally popular, then you expect the sales of each type to be equal. You have 103 total sales, and 5 different sodas, so your expected values are ...

#### HikariT

##### New Member
If the total sales are 103, and I want equal proportions the expected values would be....103/5 = 20.6. Is that right?

#### Dragan

##### Super Moderator
Can you tell me how to do it correctly? Thanks again

Chi-Square = (22 - 20.6)^2 / 20.6 + (24 - 20.6)^2 / 20.6 + (12 - 20.6)^2 / 20.6 + (15 - 20.6)^2 / 20.6 + (30 - 20.6)^2 / 20.6.

You should be able to take it from here...