# Chi-squared test for homogeneity to compare subsets of a population?

Everything I have read states that one of the conditions for inference of chi-squared is that random sampling is carried out (e.g. https://stattrek.com/chi-square-test/homogeneity.aspx). Can I still use chi-squared on subsets of an entire population (i.e. that together make up the population rather than samples of a population)?

I am doing an analysis project on titanic data (from Kaggle)

One thing I have discovered is that the mean survival rates for adult men, adult women, children and over 60s vary significantly. I want to prove that the differences are statistically significant.

(Note: When I state mean survival rate - The data is in the format where 0=Non-survivor and 1=Survivor. The mean is simply an average of the 1s and 0s for each demographic)

Update: following the responses, I tried using chi squared on my population and this is what I got.

|            |   Observed Survivors    |    Expected Survivors
| Adult Man  |        84               |     191.919192
| Adult Woman|        192              |      98.262626
| Child      |         61              |      43.373737
| Senior     |         5               |       8.444444


Using the data above and the chi-square script method I got a chi squared of 158. This seems very high. Have I done something wrong?

chisquare(f_obs = observed_survivors, f_exp = expected_survivors, ddof=3, axis =0)

• I'm not sure what you mean in the second sentence of your first paragraph. If your available data is a strict subset of the population then that would be considered a sample, not the entire population. Do you have all the data from the population or not?
– Ben
Dec 28, 2018 at 8:24
• Thanks for your reply @Ben , by subset I mean that it's not random - I have segmented my data to give the four groupings above. The subsets have been chosen because I felt they would result in variation. Dec 28, 2018 at 15:43