[R] Manova

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Dec 18 12:04:31 CET 2003


Göran Broström <gb at stat.umu.se> writes:

> Dear R-helpers,
> 
> In a data set I got from a medical doctor there are six treatment groups
> and (about) 5 bivariate responses in each group. Using 'manova', it is
> easy to see significant differences in treatment effects, but the doctor
> is more interested in the correlation between the two responses (within
> groups). I'm willing to assume a common value over groups, and one way
> of estimating and testing the common correlation would be to use
> 'cor.test' on the residuals from 'manova', but I guess that the
> resulting p-value (from testing zero correlation) will be far too
> optimistic (it is in fact 4.5e-5).

I think you're getting correlation right, but the DF wrong since 5 DF
are lost to treatment contrasts. Hence the t statistic is wrong too
(wrong DF *and* inflated by about 20%). 
 
> What is the 'right' way of doing this in R?

Is there one? 

One expedient way is to look for a zero regression coef in

summary(lm(v1~treat+v2)) # or vice versa

or you could clone the calculation from getS3method("cor.test","default")

        r <- cor(x, y)
        df <- ??? # insert properly calculated DF here.
        STATISTIC <- c(t = sqrt(df) * r/sqrt(1 - r^2))
        p <- pt(STATISTIC, df)

or you could look for a test of independence in the multivariate
normal distr. on CRAN. (I don't know if there is one -- it's your
problem... ;-) )

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list