# Chi-squared test of independence with one binary dependent variable

I am given a sample with n = 100 of patients with risk factor information for all of them (binary variable, yes/no) and the disease status (also binary). I have to find the association between each individual risk factor and the disease and supply the result as a p-value and $\chi^2$ value.

I thought I would make a 2×2 contigency table for each risk factor, where one variable was presence of disease and the other the presence of a risk factor. After that I simply used the formula $\chi^2 = \sum{\frac{(O - E)^2}{E}}$ and obtained the $\chi^2$ and p values. Is this a correct or wrong way to do this? If not then how should I have done it?

• Welcome to the site. If this is a homework question, please add the self-study tag and read its wiki. To answer your other question, if you are tasked with bivariate analysis of the association between your outcome and the risk factor variables, then your approach is correct – Marquis de Carabas Jan 4 '17 at 15:24
• Maybe you should consider logistic regression with risk factor as predictor. – Mur1lo Jan 5 '17 at 1:37

You could do a $\chi^2$ test, but you could also just note that, in a 2-by-2 table, the rows and columns are independent iff the OR = 1. The standard error of the log odds ratio is the sum of the reciprocals of the cell counts. Checking whether log of the OR divided by that standard error is greater than 1.96 (in absolute value) is an approximate $\alpha=.05$ test of independence.