Skip to content

mantelhaen.test for more than two groups?

4 messages · Thomas Lumley, Katrin Schweitzer, Peter Dalgaard +1 more

#
On Tue, 26 Apr 2005, Katrin Schweitzer wrote:

            
You're supposed to have a three-dimensional array: exposure x response x 
group.

This means turning your three group variables into one variable.  One way 
to do this is with the interaction() function.

 	-thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle
#
Dear All,

I'd like to perform the generalized Cochran-Mantel-Haenszel-Test (as 
described in Agresti (1990), Categorical Data Analysis) for my nominal data.

My problem is that I have more than two groups. In fact I think I'd need 
an 5-dimensional array for the response variable, the control variable 
and three group variables.
Could you please tell me if this is possible in R - and if yes how I am 
supposed to do this?

By now I get an error message:
 >MyData<-array(c(21,6,0,18,8,1,46,9,2,12,8,1,35,3,7,9,2,8,58,5,11,3,2,4,14,0,0,21,0,0,26,0,0,12,0,0,32,0,0,25,0,0,62,0,0,16,0,0),dim=c(3,2,2,2,2))
 >mantelhaen.test(MyData)
Error in mantelhaen.test(MyData) : x must be a 3-dimensional array
 >

I'm using R Version 1.9.1 on a Linux machine.

I apologize in case I am completely wrong by choosing this test, which 
might be the fact as this is my very first struggle with statistics... :)

In the hope of not losing it,
thank you very much for any help,
:) Kati
#
Thomas Lumley <tlumley at u.washington.edu> writes:
Or, if data are already counts, change the dimensions (as in dim(x) <-
c(2,3,8)), possibly after using aperm() to get the indices in the
right order.
#
How about using logistic regression?  When you have K dimensional tables and 
several potential confounders it might be better to go for a multivariable 
model. Take a look at function glm(stats) and lrm(Design).

Cheers

Francisco