Dormitory residency is sometimes advertised as being beneficial to students because it helps foster a connectedness to the university and maybe help the students develop an academic lifestyle. In one study involving 408 entering students in 1995, students were classified according to (i) whether they lived in a campus dormitory during their first year, and (ii) whether they had graduated within 6 years of entering college. The data is presented in a crossclassification table below.

We are interested in comparing 6year graduation rate of
dormitory residents versus nondormitory residents.
In terms of population parameters, we write the null and
alternative hypotheses as
Note that IF we treat dorm residency as a variable, then a test for independence between graduation rate and residency also compares graduation rate between dorm and nondorm students. Therefore, we may use the chisquare test of independence to test for equality of proportions between populations. In this case, it is called a test for equality of proportions rather than a test for independence. The null and alternative hypotheses are written differently, but the rest of the test procedure remains the same.
If the row variable has only two categories (SuccessFailure), and the columns are population labels rather than levels of a second variable, the chisquare test of independence is called a test for equality of proportions.
First compute the graduation rate marginal distribution:
Dorm  Not Dorm  Total  
Grad 6 Yrs.  224 (This is 54.9% of 408)  
Grad > 6 Yrs.  184 (This is 45.1% of 408)  
Total  364  44  408 
Extrapolating the marginal distribution to each individual column, we get the following expected frequencies:
(.549)(364)=199.84  (.549)(44)=24.16 
(.451)(364)=164.16  (.451)(44)=19.84 
The chisquare test compares these expected frequencies to the observed frequencies. The null hypothesis is rejected if observed and expected frequencies are too far apart.
Here is the way a statistical report would formally present the test, in numbered stages.