The test (goodnes-of-fit) is also called the one sample test and is used to test the compatibility of values observed for () categories of one feature with hypothetical expected values for this feature. The values of all measurements should be gathered in a form of a table consisted of rows (categories: ). For each category there is written the frequency of its occurence , and its expected frequency or the probability of its occurence . The expected frequency is designated as a product of . The built table can take one of the following forms:
Basic assumptions:
Hypotheses:
Test statistic is defined by:
This statistic asymptotically (for large expected frequencies) has the Chi-square distribution with the number of degrees of freedom calculated using the formula: .
The p-value, designated on the basis of the test statistic, is compared with the significance level :
The settings window with the Chi-square test (goodness-of-fit)
can be opened in Statistics
menu → NonParametric tests (unordered categories)
→Chi-square (goodnes-of-fit)
or in ''Wizard''.
We would like to get to know if the number of dinners served in some school canteen within a given frame of time (from Monday to Friday) is statistically the same. To do this, there was taken a one-week-sample and written the number of served dinners in the particular days: Monday - 33, Tuesday - 29, Wednesday - 32, Thursday -36, Friday - 20.
As a result there were 150 dinners served in this canteen within a week (5 days). We assume that the probability of serving dinner each day is exactly the same, so it comes to . The expected frequencies of served dinners for each day of the week (out of 5) comes to .
Hypotheses:
The p-value from the distribution with 4 degrees of freedom comes to 0.2873. So using the significance level you can estimate that there is no reason to reject the null hypothesis that informs about the compatibility of the number of served dinners with the expected number of dinners served within the particular days.
Note!
If you want to make more comparisons within the framework of a one research, it is possible to use the Bonferroni correction2). The correction is used to limit the size of I type error, if we compare the observed frequencies and the expected ones between particular days, for example:
Friday Monday,
Friday Tuesday,
Friday Wednesday,
Friday Thursday,
Provided that, the comparisons are made independently. The significance level for each comparison must be calculated according to this correction using the following formula: , where is the number of executed comparisons. The significance level for each comparison according to the Bonferroni correction (in this example) is .
However, it is necessary to remember that if you reduce for each comparison, the power of the test is increased.