IBM Support

Mantel-Haenszel test for trend available in crosstabs



Can SPSS calculate the Mantel-Haenzsel test for trend in a contingency table for two variables which are either ordinal or binary?

Resolving The Problem

The Crosstabs procedure includes the Mantel-Haenszel test of trend among its chi-square test statistics. This test is calculated as:

chi-square(MH) = (W-1)*r**2

where W = the sum of the case weights and r**2 is the squared Pearson correlation between the row and column variables. The test has 1 DF. If no weight variable is designated, then all case weights equal 1.00 and W equals the sample size.

The Crosstabs procedure is available from the menus at Analyze->Descriptive Statistics->Crosstabs. Paste one variable into the Rows(s) box and the other into the Column(s) box. (You can place multiple variables into each box and receive one crosstab table and chi-square set for each row*column combination.) Click the Statistics button and check the chi-square box in the upper-left corner of the Statistics dialog box to request chi-square statistics. The MH test for trend will be printed in the "Chi-Square Tests" table and labelled "Linear-by-Linear Association". Note that this test will not be printed for any table in which either the row or column variable is a string variable. You can recode such a variable into a new numeric variable and use that numeric variable in the Crosstabs procedure. The Crosstabs procedure does not apply the Measure attribute of the variables in the data dictionary, so the result of this test will not depend on whether the variables are marked as Scale, Ordinal, or Nominal. Note that the formula above applies the Pearson correlation so the variables are effectively treated as Scale for this test.

If you run the Crosstabs procedure by a syntax command, then the chi-square statistics are requested by adding the keyword CHISQ to the /STATISTICS subcommand, as in:

/TABLES= rating1 rating2 BY jobcat

This command would request Crosstab tables for RATING1 by JOBCAT and for RATING2 by JOBCAT, with chi-square statistics for each table.

You can find the Crosstabs algorithms via Help>Algorithms. The MH test of trend is labeled "Mantel-Haenszel Test of Linear Association" and found in the "Chi-Square Statistics" section of the Crosstabs algorithm chapter.

[{"Product":{"code":"SSLVMB","label":"SPSS Statistics"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Not Applicable","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number


Document Information

Modified date:
16 April 2020