# Selecting a proper sample from a dataset for a hypothesis test

I have a dataset of about 800k subjects and within that dataset 7025 subjects have either disease A or disease B. I'd like to test the hypothesis (chi squared test) that subjects with disease A are less likely to get disease B. Is it valid to use only subjects with at least one of the diseases as a sample? i.e only choose subjects with disease A, disease B or both diseases.

Below is a 2x2 table of the sample with only subjects that have at least one disease. There are 1000 subjects with only disease A, 6000 subjects with only disease B and 25 subjects with both. What you’ve proposed is problematic. Consider the possibility that contracting either disease indicates a heightened probability of contracting disease in general.

The control group is made up of subjects who do not have A but need not have B. Calculate the proportion of subjects with B.

The treatment group is made up of subjects who do have A but need not have B. Calculate the proportion of subjects with B.

Now compare the proportions.

Edit:

You'll have to decide if you want to do a one-tailed or two-tailed test. It sounds like you want to show that the group with A has a higher proportion of subjects with B than the non-A population has. That would be a one-tailed test. However, if you want to check if the proportion is higher because you peaked at the data and saw a higher number, that is not valid. Then you have to do a two-tailed test.

• So, of the 799,000 subjects without disease A 6000 subjects have disease B thus the proportion of subject with disease B in the control group is 6000/799000 = 0.008. Of the 1025 subjects with disease A, 25 have disease B. thus the proportion of subjects with disease B in the treatment group is 23/1000 = 0.023 Now a one tailed proportion test can be done to see if the proportion of subjects with disease B in the treatment group is higher than the proportion of subjects with disease A in the control group? @Dave – user260474 Sep 29 '19 at 15:02
• @user260474 You got it! – Dave Sep 29 '19 at 15:12
• Thanks! So I was wrong about using the chi squared test. Basically it comes down to a difference in proportion test. Also, I'm assuming that my sample size is sufficient as the overall sample is large even though the number of subjects with both diseases is small. Is that a proper assumption? – user260474 Sep 29 '19 at 15:20
• I hadn’t considered the fact that both proportions are quite low. What test were you planning to use to test the proportions? – Dave Sep 29 '19 at 15:29
• A two sample proportion test like the one given here - newonlinecourses.science.psu.edu/stat414/node/268 @Dave – user260474 Sep 29 '19 at 15:32