In the previous area, we considered the connection in between a student"s gender and whether he or she enjoys math. One question we could have actually as a result of this is whether we have the right to recognize whether tright here is a statistical test to identify if there is a relationship in between the 2 variables.

You are watching: How to calculate chi square in statcrunch

Of course, we wouldn"t be stating it if tbelow wasn"t! Before we comment on that test, we require a tiny background.

## Determining Expected Counts

Let"s assume that a student"s gender and also whether he or she enjoys math are independent. What frequencies would certainly we suppose in that case? Let"s take into consideration again the survey information from Example 2 in Section 4.4:

In that instance, a survey was given to 82 students in a Basic Algebra course at ECC, through the following responses to the statement "I gain math."

Strongly Agree | Agree | Neutral | Disagree | Strongly Disagree | |

Men | 9 | 13 | 5 | 2 | 1 |

Women | 12 | 18 | 11 | 6 | 5 |

We then created a **loved one frequency marginal distribution**, which was calculated by taking the row/column totals and splitting by the sample size of 82.

SA | A | N | D | SD | Total | |

Men | 9 | 13 | 5 | 2 | 1 | 30/82 ≈ 0.37 |

Women | 12 | 18 | 11 | 6 | 5 | 52/82 ≈ 0.63 |

Total | 21/82 ≈ 0.26 | 31/82 ≈ 0.39 | 16/82 ≈ 0.20 | 8/82 ≈ 0.10 | 6/82 = 0.07 | 1 |

Let"s emphasis on the first cell - "Men" and "Strongly Agree". From the table, we deserve to see that 30/82 or about 37% of the students were guys, and also 21/82 or about 26% of the students strongly agreed with the statement "I enjoy math." If they really are independent, we deserve to use the Multiplication Rule for independent occasions, wbelow P(E and F) = P(E)•P(F).

So if they are independent, the probability that a student is is both male and strongly agrees would be:

P(male and also strongly agrees) = | 30 | • | 21 | ≈ 0.094 |

82 | 82 |

We have the right to then use this probcapacity to recognize just how many we would *expect* in that cell, if the two variables are actually independent. We simply multiply the full number of individuals by the probability of being both male and strongly agreeing:

Expected variety of students who are male and also strongly agree | = | 82• | 30 | • | 21 | = | 30•21 | ≈ 7.68 |

82 | 82 | 82 |

In general, we have the right to find the meant worths utilizing this formula:

Expected Frequency | = | (row total)•(column total) | |

table total |

Example 1

Use the table provided and also find the supposed frequency for each outcome.

< disclose answer >

SA | A | N | D | SD | |

Men | 7.68 | 11.34 | 5.85 | 2.93 | 2.20 |

Women | 13.32 | 19.66 | 10.15 | 5.07 | 3.80 |

Now that we have actually the expected frequencies for each outcome, we require a new hypothesis test to watch if these intended counts are much sufficient from what we actually oboffered to say that the variables *aren"t* independent.

## The Test for Independence

The test we use to recognize if there is an association in between 2 qualitative variables is referred to as the** chi-square test for independence**. In this test, the null hypothesis is constantly that the variables are not associated (independent), and also the alternative is that they are connected (depedent).

The test functions by comparing the observed counts through the intended counts if we assume the 2 variables are related. If those are much enough acomponent, we can say that we think tright here *is* a connection. Here are the details:

The Test Statistic for the Test of Independence

If we let Oi reexisting the oboffered counts for the ith cell, and also Ei represent the supposed counts, then

around complies with the chi-square circulation via (r-1)(c-1) degrees of freedom, wright here r is the variety of rows and c is the number of columns, provided that:

all supposed frequencies are greater than or equal to 1, and no more than 20% of the meant frequencies are less than 5.Note: If 1 or 2 fail, we deserve to integrate categories so they are satisifed.

## Percreating a Chi-Square Test for Independence

**Tip 1****:** State the null and different hypotheses.

H0: The row and also column variables are independent. H1: The row and also column variables are dependent.

Note: Like the Goodness-of-Fit Test, this test is *always* right-tailed, because larger deviations from the meant values will cause bigger *Χ*2 worths.

**Step 2****:** Decide on a level of significance, α.

**Tip 3****:** Compute the test statistic, .

**Step 4****:** Determine the *P*-value.

**Step 5****:** Reject the null hypothesis if the *P*-worth is much less than the level of significance, α.

**Tip 6****:** State the conclusion.

Example 2

Use the data from earlier examples to determine if gender and whether a student enjoys math are connected. Perform the test at the 5% level of significance.

From previously, we have actually the observed counts:

SA | A | N | D | SD | |

Men | 9 | 13 | 5 | 2 | 1 |

Women | 12 | 18 | 11 | 6 | 5 |

And from Example 1, we know the meant counts are:

SA | A | N | D | SD | |

Men | 7.68 | 11.34 | 5.85 | 2.93 | 2.20 |

Women | 13.32 | 19.66 | 10.15 | 5.07 | 3.80 |

< reveal answer >

Notice that all intended counts are at leastern 1, however three are less than 5. Because 3 of 10 is 30%, we should integrate some categories. Our new observed and also supposed counts are then:

Observed | SA | A | N | D/SD |

Men | 9 | 13 | 5 | 3 |

Women | 12 | 18 | 11 | 11 |

Expected | SA | A | N | D/SD |

Men | 7.68 | 11.34 | 5.85 | 5.12* |

Women | 13.32 | 19.66 | 10.15 | 8.88* |

*Note: These values should be recalculated through the brand-new oboffered counts, but they"ll be cshed either way.

**Step 1****:** H0: sex and also enjoying math are independent H1: gender and also enjoying math are dependent

**Tip 2****:** α = 0.05 (given)

**Tip 3****:**

**Tip 4****:** *P*-value = P(*Χ*2 > 2.32, df=3) ≈ 0.5085.

**Step 5****:** Due to the fact that the *P*-value is *much* larger than α, we execute not reject the null hypothesis.

**Tip 6****:** No, tbelow is clearly not sufficient proof based upon this sample to say that the variables are not independent. In other words, also though the expected counts are different from the observed counts, they"re not different *enough* for us to say that the 2 couldn"t be independent.

### Chi-Square Test for Independence Using StatCrunch

You"ll must initially enter the data, through row and also column labels. (Leave the initially column for row labels.) Choose Stat > Tables > Contingency > via summary Select the columns for the oboffered counts. Select the column for the row variable. Click Next. Check "Expected Count" and select Calculate. The outcomes need to appear. More information is obtainable in the aid file with StatCrunch. |

You have the right to likewise go to the video web page for links to see videos in either Quicktime or iPod format. |

Example 3

Repeat the previous instance making use of technology.

< expose answer >

Here are the results making use of StatCrunch:

We deserve to check out that the *P*-value is 0.5085, and so we have actually no evidence to say that tbelow is an association between sex and whether or not a student enjoys math.

## The Test for Homogeneity of Proportions

Suppose the Math Department at ECC would certainly choose to compare success prices in its College Algebra course based on exactly how students put right into the class. Tbelow are currently 3 methods of placing right into the course:

earning a C or much better in the Mth098 - Intermediate Algebra; or an correct placement test score; or a Math ACT of 23 or better.In this case, the department could want to analyze the proportion who are successful in College Algebra (i.e. earning a C or better). They wonder if the proportions are all the very same, or if one is different. One means to answer this would be to perform propercentage tests via all of the feasible pairs, however that would entail three separate tests like those we studied in Section 11.3.

Another option is a brand-new test - the **chi-square test for homogeneity of proportions**. In a chi-square test for homogeneity of proparts, we test the insurance claim that different populations have the exact same propercent of individuals via a specific characteristic.

Interestingly, the actions for performing a chi-square test for homogeneity of proparts is the same to that for the test of independence.

Example 4

In the Fall of 2005, the ECC math department asked the Institutional Research department to collect data from previous semesters to analyze. The table listed below reflects the outcomes for Fall 2004 and also Spring 2005.

Mth098 | placement | ACT 23+ | |

successful | 132 | 94 | 163 |

not successful | 140 | 52 | 62 |

Is there proof to suggest that the proportion of students in each group that are effective is various at the α = 0.01 level of significance?

< disclose answer >

**Tip 1****:**H0: p1 = p2 = p3H1: At leastern among the prosections is different from the others.

**Tip 2****:** α = 0.01 (given)

**Steps 3 & 4****:**

**Step 5****:** Due to the fact that the *P*-value α, we have to refuse H0.

See more: What Does Drop Me A Line Mean Ing, Definition, Examples, Origin, Synonyms

**Step 6****:**Since the *P*-worth is so small, we have actually extremely strong evidence suggesting that at leastern among the proparts is different from the others.