4
$\begingroup$

I have 10 samples which has males and females. I want to check whether the sex ratios in any of these sample are significantly different from other. Can someone please help me what test can I use in R to find this?

$\endgroup$
1
  • $\begingroup$ It depends on (a) the sample sizes and (b) whether you want to test for any differences or all possible differences. For instance, with large samples you can test for any difference with an Analysis of Deviance using glm (with the Binomial family) and anova (following examples in their help pages)--but that approach can fail for small samples and will be inappropriate for testing all differences. In light of this, please edit the post to clarify your situation. $\endgroup$
    – whuber
    Commented Aug 2, 2016 at 3:23

2 Answers 2

3
$\begingroup$

First, note that ratios being different is equivalent to proportions being different. So you need to test for different proportions.

Here is the null hypothesis - $H_0: p_1 = p_2 = p_3 = ...$ - and the alternative hypothesis is simply that one proportion does not equal one of the others.

Let $X_i = $ the number of males in group i and $n_i = $ the number of people in group i. Under the null hypothesis of one common probability, we can estimate the probability someone is male: $\bar p = \frac{\sum{X_i}} {\sum{n_i}}$.

Define $\hat X_i$ to be our expectation of what $X_i$ should be under the null hypothesis: $\hat X_i = \bar p * n_i$.

Given large sample sizes, $X_i$ is approximately normally distributed. If $X_i$ is normally distributed, then the following test statistic is chi-squared distributed with 9 (number of groups minus 1) degrees of freedom: $\chi ^ 2 = \sum{\frac{(X_i - \hat X_i)^2} {\hat X_i}}$. If the test statistic exceeds the critical value, the null hypothesis can be rejected. In this example, you need a statistic of at least 16.919 to reject at .05 significance.

See here - http://www.itl.nist.gov/div898/handbook/prc/section4/prc46.htm - for an example.

$\endgroup$
2
$\begingroup$

As Wart has pointed out, the $\chi^2$ test for homogeneity (i.e. independence) is a good way to proceed in this situation. In R, this can be done with the command

chisq.test(mytable) 

Documentation

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.