Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SPSS Cochran-Mantel-Haenszel test

1,067 views
Skip to first unread message

Irini Liampa

unread,
Jun 14, 2015, 11:13:34 AM6/14/15
to
Hello everyone!

I am trying to analyze in SPSS a data set containing the dichotomous response of repeated measurements at different time points of two groups of patients that have been given a different treatment (a table of zeros for failure and ones for success in some tasks). My data sheet looks like that:
T0+20m T0+1h T0+3h
drug1 0 0 1
drug1 0 0
drug1 0 0 0
drug2 0 0 0
drug2 0 0 0
drug2 0 1 0

The respective publications mention that the Cochran-Mantel-Haenszel test is appropriate for the comparison of the response between the two groups, because of the repeated measurements.As I do not usually use SPSS I do not know how to perform it.Can anyone help?

Thank you in advance!

Rich Ulrich

unread,
Jun 15, 2015, 1:07:06 AM6/15/15
to
What I find online suggests that you can go to
"nonparametric statistics" and "related samples"
to find the "Cochran test". If it asks for separate variables
for the 3 periods, then it must be the right one.

Googling found me a number of sources that consider
"Cochran-Mantel-Haenszel" as the name for the test
that does *not* have "related samples". So that is a problem
with searching this by Google.

I'm pretty sure that you can get a test similar to the CMH
out of the Cox Regression, though it has been a long time
since I looked. - Cox might be able to handle the apparent
Missing in line 2 of your example, whereas any real CMH
probably will not.

--
Rich Ulrich

Irini Liampa

unread,
Jun 15, 2015, 3:14:41 AM6/15/15
to
Thank you so much for your answer!

I have tried the option of the non-parametric statistics/related samples (for 2 samples ang k samples, when I wanted to analyze 3 different time points) already,but it seems to take all the measurements together, although they come from two separate groups. What I want to do is to compare the results of the two groups in respect to their responses on the different time points.

It's true that googling didn't get me any useful results,at least for my research. Perhaps this is because this test is not quite a mainstream one.

Concerning the missing values, that are produced during a previous part of my analysis, I though that CMH would just exclude the respective samples. If not, then probably I will have to look for another option.

Rich Ulrich

unread,
Jun 15, 2015, 2:19:40 PM6/15/15
to
On Mon, 15 Jun 2015 00:14:39 -0700 (PDT), Irini Liampa
<irini....@gmail.com> wrote:

>Thank you so much for your answer!
>
> I have tried the option of the non-parametric statistics/related
> samples (for 2 samples ang k samples, when I wanted to analyze 3
> different time points) already,but it seems to take all the
> measurements together, although they come from two separate groups.

Huh? What you say does not make sense to me, "take
all the measurements together." Does the procedure
fail to ask for the right information -- a grouping variable,
and then for several outcomes?

Or does it give odd results? (which you might cut-and-paste?)

Or what?


> What I want to do is to compare the results of the two groups in
> respect to their responses on the different time points.

And the Cochran should be the extension of the "McNemar test
for changes" with two groups and two measures of status...
extending it to several measures.

If none of the component McNemars (considering each pair
of periods) show any hint of difference, then you can be
pretty sure that there is no overall difference.

ON THE OTHER HAND: ANOVA handles dichotomies as
outcomes with good robustness and not much loss of power.

If you start out with the expectation of a trend, you
could run a repeated measures, three periods for two
groups, and look at the test for interaction of grouip with
linear trend, and that would be a "pretty good" test.
The test for trend will have more power than the test
for simple group-period interaction, though that test will
be valid, too.


>
>It's true that googling didn't get me any useful results,at least for my research. Perhaps this is because this test is not quite a mainstream one.
>
>Concerning the missing values, that are produced during a previous part of my analysis, I though that CMH would just exclude the respective samples. If not, then probably I will have to look for another option.

Yes, the CMH would exclude subjects with Missing.

--
Rich Ulrich

Bruce Weaver

unread,
Jun 15, 2015, 5:25:10 PM6/15/15
to
Hello Irini. First, note that nowadays, one can use logistic regression
in place of the Cochran-Mantel-Haenszel test. A few years ago, I
generated an example, which can be seen here:

http://www.angelfire.com/wv/bwhomedir/spss/pooling_odds_ratios.txt

With that in mind, I think you could do something like this:

1. Use VARSTOCASES to restructure the data from WIDE to LONG (i.e., up
to 3 rows for each ID).

2. Use GENLIN with generalized estimating equations (GEE) to analyze the
data. (GEE is one way to take into account the correlated nature of
repeated measures data.)

You would include in your model Treatment, Time, and their interaction.
The interaction term will provide a test of homogeneity of the odds
ratios for Time across the different treatments; or looking at it the
other way, homogeneity of the odds ratios for Treatment over the
different time points.

The basic GENLIN syntax would be something like this (with your variable
names in place of the ones I've used):

GENLIN DepVar (REFERENCE=FIRST) BY Treat Time (ORDER = DESCENDING)
/MODEL Treat Time Treat*Time INTERCEPT=YES
DISTRIBUTION=BINOMIAL LINK=LOGIT
/CRITERIA METHOD=FISHER(1) SCALE=1 MAXITERATIONS=100
MAXSTEPHALVING=5 PCONVERGE=1E-006(ABSOLUTE)
SINGULAR=1E-012 ANALYSISTYPE=3(WALD) CILEVEL=95 LIKELIHOOD=FULL
/REPEATED SUBJECT=ID WITHINSUBJECT=Time SORT=YES
CORRTYPE=unstructured ADJUSTCORR=YES
COVB=ROBUST MAXITERATIONS=100 PCONVERGE=1e-006(ABSOLUTE)
UPDATECORR=1
/MISSING CLASSMISSING=EXCLUDE
/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION
(EXPONENTIATED).

You could try some different covariance structures where I have
CORRTYPE=unstructured. The ones that come to mind are:

- AR(1). AR(1) working correlation matrix (AR = autoregressive).
- EXCHANGEABLE. Exchangeable working correlation matrix.

HTH.

--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
"When all else fails, RTFM."

Irini Liampa

unread,
Jun 15, 2015, 10:00:29 PM6/15/15
to
Thank you all so much for your help!

Well, what I did was using the VARSTOCASES command to make a new variable of time from my measurements on 3 different time points and then I was able to use the Analyze>Descriptive Statistics>Crosstabs>Statistics to perform the Cochran-Mantel-Haenszel tests. Does this seem reasonable to you?

I also tried the Binary Logistic Regression on the same new variable, which gives me pretty much the same results.

Now, about the Cochran test, there is no option for grouping variable in the non parametric tests for related samples, or at least I was not able to find one. That's why I thought that perhaps it takes all the measurements on each time point together and checks for difference between the different time points.

Bruce Weaver

unread,
Jun 15, 2015, 10:13:46 PM6/15/15
to
On 15/06/2015 10:00 PM, Irini Liampa wrote:
> Thank you all so much for your help!
>
> Well, what I did was using the VARSTOCASES command to make a new variable of time from my measurements on 3 different time points and then I was able to use the Analyze>Descriptive Statistics>Crosstabs>Statistics to perform the Cochran-Mantel-Haenszel tests. Does this seem reasonable to you?

No, because it treats the repeated measures as independent observations,
which they are not. That is why I suggested using GENLIN with GEE to
handle your TIME variable.

>
> I also tried the Binary Logistic Regression on the same new variable, which gives me pretty much the same results.

This also treats the repeated measures as independent observations.

>
> Now, about the Cochran test, there is no option for grouping variable in the non parametric tests for related samples, or at least I was not able to find one. That's why I thought that perhaps it takes all the measurements on each time point together and checks for difference between the different time points.
>


Irini Liampa

unread,
Jun 15, 2015, 11:27:33 PM6/15/15
to
I am a bit confused. My dependent variable is the dichotomous response in "time variable", consisting of 3 different time points, so I do not have any other variable in the model but the grouping one (the treatment). So any interaction would be observed between the measurements in my dependent variable. How could I model this?
This is the reason why the CHM test was proposed in the first place (to check for the indepedence in repeated measurements) and then I decided to choose an option from the Related samples as an alternative. If the measurements are treated as independent, what would be the point of using the CMH test after all? I could do a Fisher's exact test.

Rich Ulrich

unread,
Jun 15, 2015, 11:54:48 PM6/15/15
to
On Mon, 15 Jun 2015 19:00:28 -0700 (PDT), Irini Liampa
<irini....@gmail.com> wrote:

...
>
> Now, about the Cochran test, there is no option for grouping
> variable in the non parametric tests for related samples, or at
> least I was not able to find one. That's why I thought that perhaps
> it takes all the measurements on each time point together and checks
> for difference between the different time points.

Oh! I guess I was following your lead, and assumed that the
CMH would do. But CMH generalizes the "NcNemar test for
changes", and that test uses only two dichotomous variables
for the hypothesis, "Is there change?" The generalization to
three or more tests is still, "Is there change?" - without any
grouping variable.

My mistake. I wonder if you can check your source(s) that
specified that test, because it no longer seems at all right
for your group-hypothesis.

And I agree with Bruce, that those other tests you mention
do not include the Repeated aspect.

Finally, I think you could do a discriminant function on the
data as originally set up, 2 groups and 3 variables.

--
Rich Ulrich

Irini Liampa

unread,
Jun 16, 2015, 1:01:22 AM6/16/15
to
But I thought something like this:
"Use the Cochran-Mantel-Haenszel test (which is sometimes called the Mantel-Haenszel test) for repeated tests of independence. The most common situation is that you have multiple 2×2 tables of independence; you're analyzing the kind of experiment that you'd analyze with a test of independence, and you've done the experiment multiple times or at multiple locations. There are three nominal variables: the two variables of the 2×2 test of independence, and the third nominal variable that identifies the repeats (such as different times, different locations, or different studies)."

and I am definately positive that the Cochran-Mantel-Haenszel test is mentioned by my source.

I can only suppose that the problem comes from the different tests that share a common name. I found out that there are three of them, the one that I want to use which is sometimes called the Mantel-Haenszel test, a test for homogeneity of odds ratios called the Mantel-Haenszel test and a Mantel-Haenszel test of independence for one 2×2 table.

In this case I don't know how to perform the right one.
Message has been deleted

Bruce Weaver

unread,
Jun 16, 2015, 7:47:56 AM6/16/15
to
For the Cochran-Mantel-Haenszel test, the various strata are independent
groups (e.g., males & females in the example I pointed you to earlier).
Unless your source is pointing to a modified version of the
Cochran-Mantel-Haenszel that can handle repeated/correlated measures, I
would not use it for your data. The GENLIN approach I posted earlier in
the thread does take into account the repeated nature of the data over
time.

HTH.

Bruce Weaver

unread,
Jun 16, 2015, 7:51:55 AM6/16/15
to
On 16/06/2015 1:32 AM, Irini Liampa wrote:
> Thank you so much for your help!
>
> I think that I finally found out what to do. And it was the name of the test that caused so much confusion.
>
> Here is the link with the instructions:
> http://www-01.ibm.com/support/docview.wss?uid=swg21477269
>
> What I did was to RECODE the grouping variable into a numeric one (1 for drug1 and 2 for drug2) and choose the Chi-square tests in the Crosstabs window. In the table with the results the Linear-by-linear association p-value finally appeared!
>

That Mantel-Haenszel Chi-square test for linear trend is not the same
thing as the Cochran-Mantel-Haenszel test. The latter involves
computing a pooled odds ratio (pooling across strata, which are
independent groups). A test of heterogeneity (of the odds ratios for
the individual strata) is included in the output.

The Mantel-Haenszel Chi-square test for linear trend is not appropriate
for repeated measures data: Each subject must appear once and only once
in the contingency table.

Irini Liampa

unread,
Jun 16, 2015, 12:49:27 PM6/16/15
to
Sorry for my last (deleted) post,but I thought totally mistakenly that I had finally found out what to do,but then I understood my fault.
I wrote an email to the author of the source I use,and as you may have imagined, he replied that indeed SPSS does not perform the type of Cochran-Mantel-Haenszel test that he mentioned in the papers, or at least it is not performed correctly for this type of data. Hopefully he sent me an excel file containing the appropriate procedure.
I will check the results and compare them to the method that you suggested.
Thank you again so much for your help!

Bruce Weaver

unread,
Jun 16, 2015, 2:47:56 PM6/16/15
to
Is this your "source", by any chance?

http://www.jstor.org/stable/2533489?seq=1#page_scan_tab_contents

Irini Liampa

unread,
Jun 17, 2015, 6:25:01 AM6/17/15
to
I could not possibly know, because no publication is cited for the test statistic in the paper that contains an analysis example, nor any mathematical equations. Only the name of the test was mentioned and that it tests for difference in difference between groups over time.

Irini Liampa

unread,
Jun 17, 2015, 8:45:09 AM6/17/15
to
So would you suppose that the CMH test that is used is the Mantel-Haenszel method that estimates the pooled odds ratio for all strata? (I cannot see the equations in the file that I was given...)

Bruce Weaver

unread,
Jun 30, 2015, 6:04:41 PM6/30/15
to
On 16/06/2015 7:51 AM, Bruce Weaver wrote:
> On 16/06/2015 1:32 AM, Irini Liampa wrote:
>> Thank you so much for your help!
>>
>> I think that I finally found out what to do. And it was the name of
>> the test that caused so much confusion.
>>
>> Here is the link with the instructions:
>> http://www-01.ibm.com/support/docview.wss?uid=swg21477269
>>
>> What I did was to RECODE the grouping variable into a numeric one (1
>> for drug1 and 2 for drug2) and choose the Chi-square tests in the
>> Crosstabs window. In the table with the results the Linear-by-linear
>> association p-value finally appeared!
>>
>
> That Mantel-Haenszel Chi-square test for linear trend is not the same
> thing as the Cochran-Mantel-Haenszel test.

In hindsight, what I wrote there is not quite correct.

In an attempt to avoid confusion about which Mantel-Haenszel test I'm
talking about:

1. Let A = Mantel-Haenszel Chi-square test for trend, which is displayed
as the test of "linear-by-linear" association when one includes CHISQ on
the /STATISTICS sub-command for CROSSTABS
(http://www-01.ibm.com/support/docview.wss?uid=swg21477269).

2. Let B = the Mantel-Haenszel Chi-square test that appears in a box
labelled "Tests of Conditional Independence" when one includes CMH(1) on
the /STATISTICS sub-command for CROSSTABS.

For a single 2x2 table, A and B *would* be equivalent if SPSS did not
apply a continuity correction when computing B. But it does apply a
continuity correction, and I don't think there is any way to prevent it.

Some other statistical software packages (e.g., SAS and Stata) do *not*
apply the continuity correction when computing B, and so their results
for B match the SPSS results for A (for a single 2x2 table).

I doubt this changes anything for the OP. I just wanted to correct my
earlier statement about the two Mantel-Haenszel tests being *different*
tests.

HTH.
0 new messages