# Test of independence on contingency table

I have a simple contingency table with two nominal variables. Let's say Age and Gender. The software that I'm using reports the relationship between the two variables using Pearson's Chi-Square Test of Independence, to which I understand.

But when I select only two cells in the table and try to do a test for that, the software reports it still uses Pearson's Chi-Square Test of Independence, but use it to test the difference in the population (see below).

Q: Why does the software use the same Chi-Square test to test the difference in the population for the two cells I select. Shouldn't that be a t-test? Shouldn't that the chi-square be used to test the relationship for the two variables,

Q: Statistically, what's the interpretation if I try to do a hypothesis testing on only two cells in a table?

Total sample
Unweighted
base n = 327

Pearson's Chi-Square Test of Independence
Chi-Square = 0.023
Degrees of Freedom = 1
n = 327
Effective Sample Size = 327
Agresti, Alan (1990): Categorical Data Analysis, John Wiley & Sons: New York, pp 24-25, 47-48.
p = 0.88

Not significant

Null hypothesis: There is no difference in the population between the proportion of '18 to 24' of people in 'Male' than 'Female'.

At the 0.05 level of significance, the null hypothesis is not rejected.


In the case of 2x2 contingency tables, the $z$-test of whether two proportions are equal is equivalent to the Pearson $\chi^2$ test of independence: the quantity $z^2$ is the Pearson $\chi^2$ statistic (Agresti, Introduction to Categorical Data Analysis, p. 26).
Keep in mind that the $t$-test is, essentially, a heavier-tailed $z$-test, and is used to counterbalance the (inappropriately narrow) confidence bands in the case of smaller sample sizes; asymptotically, as one increases the $t$ distribution's degrees of freedom to infinity (which happens as sample size increases), the tails of the $t$ distribution diminish and it approaches the normal.
Your results are interpreted in the ordinary way as for a Pearson $\chi^2$ test.