How to do a Chi-square test when you only have proportions and denominators

by guest


by Annette Gerritsen, Ph.D.

In an earlier article I discussed how to do a cross-tabulation in SPSS. But what if you do not have a data set with the values of the two variables of interest?

For example, if you do a critical appraisal of a published study and only have proportions and denominators.

In this article it will be demonstrated how SPSS can come up with a cross table and do a Chi-square test in both situations. And you will see that the results are exactly the same.

‘Normal’ dataset

If you want to test if there is an association between two nominal variables, you do a Chi-square test.

In SPSS you just indicate that one variable (the independent one) should come in the row, and the other variable (the dependent one) should come in the column of the cross table.  Then you ask for row percentages and the Chi-square statistic.

The output will give you the cross table with the numbers and row percentages, and a table including the value of the Pearson Chi-square together with a p-value. [Don’t forget to check whether the Chi-square test is valid: at least 80% of the expected frequencies exceed 5 and all the expected frequencies exceed 1.]

For example, to see if the chance of getting a disease (e.g. an infection as complication after an operation) is different between those using medication A as prophylaxis and those using medication B, you would ask for a cross table of disease by medication. The SPSS output is printed below.

Only proportions and denominators available

But how do you do a Chi-square test when you only have proportions and denominators available?

For example, you know from the literature that 33.0% of 276 people using medication A got the disease, while 34.4% of the 392 persons getting medication B got the disease.

How do you know if this is significantly different or not?

The first step is to construct the cross table yourself. Determine what figure should come in the cell for which variable 1 (medication) equals 1 and variable 2 (disease) equals 1. This is 0.33 * 276 = 91.

You do the same for the cell for which variable 1 equals 2 and variable 2 equals 1 (0.34 * 392 = 135). To get the figure for the cell for which variable 1 equals 1 and variable 2 equals 2, you deduct the 91 from the 276 and get 185. You follow the same procedure for the cell for which variable 1 equals 2 and variable 2 equals two (392 – 135 = 257).

You now have to enter these data into SPSS in the following way:

medication      disease             count

1                     1                           91
2                     1                         135
1                     2                         185
2                     2                         257

In order to have SPSS produce the cross table and calculate the Chi-square value, you use the ‘weight by’ option. The SPSS syntax is printed below.

WEIGHT BY count.

/TABLES=medication BY disease

And you will get exactly the same output as with the ‘normal’ dataset. So when you need to know whether there is an association between two nominal variables and you do not have the original dataset, knowing the proportions and denominators is enough to get your answer.

About the Author: With expertise in epidemiology, biostatistics and quantitative research projects, Annette Gerritsen, Ph.D. provides services to her clients focusing on the methodological soundness of each phase of an epidemiological study to ensure getting valid answers to the proposed research questions. She is the founder of Epi Result.

Bookmark and Share

Get our free webinar recording titled: Ten Data Analysis Tips in R with David Lillis.

{ 28 comments… read them below or add one }

Leave a Comment

Please note that Karen receives hundreds of comments at The Analysis Factor website each week. Since Karen is also busy teaching workshops, consulting with clients, and running a membership program, she seldom has time to respond to these comments anymore. If you have a question to which you need a timely response, please check out our low-cost monthly membership program, or sign-up for a quick question consultation.

Previous post:

Next post: