**Answer:**

And we can find the p value using the following excel code:

"=1-CHISQ.DIST(27.356,9,TRUE)"

Since the p value is lower than the significance level assumed 0.05 we can reject the null hypothesis at 5% of significance, and we can conclude that we have association between the two variables analyzed.

**Step-by-step explanation:**

A **chi-square goodness of fit test** "determines if a sample data matches a population".

A **chi-square test for independence** "compares two variables in a contingency table to see if they are related. In a more general sense, it tests to see whether distributions of categorical variables differ from each another".

Assume the following dataset:

Amusement Parks Mexico Home Other Total

Freshman 23 21 43 21 108

Sophomore 34 23 14 26 97

Junior 25 30 23 26 104

Senior 27 33 17 19 96

Total 109 107 97 92 405

We need to conduct a chi square test in order to check the following hypothesis:

H0: There is independence between the two random variables

H1: There is dependence between the two variables

The level os significance assumed for this case is

The statistic to check the hypothesis is given by:

The table given represent the observed values, we just need to calculate the expected values with the following formula

And the calculations are given by:

And the expected values are given by:

Amusement Parks Mexico Home Other Total

Freshman 29.07 28.53 25.87 24.53 108

Sophomore 26.11 25.63 23.23 22.03 97

Junior 27.99 27.48 24.91 23.62 104

Senior 25.84 25.36 22.99 21.81 96

Total 109 107 97 92 405

And now we can calculate the statistic:

Now we can calculate the degrees of freedom for the statistic given by:

And we can calculate the p value given by:

And we can find the p value using the following excel code:

"=1-CHISQ.DIST(27.356,9,TRUE)"

Since the p value is lower than the significance level assumed 0.05 we can reject the null hypothesis at 5% of significance, and we can conclude that we have association between the two variables analyzed.