 In this problem, the hospital administrator thinks that the distribution of patients coming into the clinic has changed. And she has records dating back in 2018, and she calculated the distribution of patients in 2018, but she thinks that currently they're not matching. So she does a survey for a month in November, and she gets this number of patients for each of the times a day, morning, afternoon, evening, and night. Now this is a categorical data situation because we have counts, and we have categories. We just have one variable, the time of day, and so we want to do a one-way chi-square test, which is known as a goodness of fit test. And we're going to do it using the megastat tool. We need to start by calculating our expected values for this information. And I'm going to click in that cell, which I've already formatted a bit, and type a formula equal the percentage for that category times the total in the survey, the total count in the survey. And then I'm going to use the Excel lockdown key F4, which adds those dollar signs and locks down that total for me, hit Enter, and we get 180. And now I can grab this corner and drag it down for the other three categories, and check to see that the total does match. Now note that you are allowed in megastat to have your expected counts to have decimals. They don't have to be integers, which is good, but quite often these numbers won't work out as neatly as this did. So now we're going to use megastat. I go up into the ribbons and look for data, click on that, and over on the right side I will get megastat. And we get our dialog box, and I want to go down to chi-square cross tab, and I want to go for the goodness of fit test. Click on that, and it will open up another dialog box. And here we need to, first of all, input our observed values. So I'm going to click in there, make sure I've got my insertion point in there. And here's my survey, that's my observed data, and do not include the totals and do not include any labels. Now I want to click in the other little window for my expected values, and those are the ones we calculated. Again, just the values, no titles, no sums. And we don't need to worry about the number of parameters estimated from the data. It will default to zero, so just ignore that. And we click OK. And after a few seconds, we get our output inserted on a new worksheet, and it's labeled goodness of fit test, and we've got our observed, our expected, we've got the calculations that are used to come up with your chi-square. And over here is the column that shows you the percentage of the chi-square statistic that is accounted for by this particular category. What I'd like to do to see it better, go back to my sheet. I'm going to copy these category names, Control-C, go back here, and I'm going to insert those there, paste them in, so now we can see a little bit better that the morning accounts for 70% of the difference that was making that chi-square big, and the evening is also a big impact, although it's in the other direction. We look down here, and we've got our chi-square test statistic, 7.14. It tells us we've got three degrees of freedom, and that is just the number of categories minus one, and it calculates the p-value 0.675, which is greater than 0.05, so that is not significant. One of the things I like to do is get my critical value, and I let the Excel calculate for me. I use an equal, start typing chi-square, and I want to pick the inverse right tail, the chi-square test we run is always a right tail test. It wants probability, that's our significance level, 0.05, and it wants the degrees of freedom, which I read up there, three, close, parentheses, enter, and that gives my critical value of chi of 7.14, which is bigger than, of course, our statistic. And that's the second method, and it also tells us do not reject a null. So I hope this helped.