[R] MANCOVA

Peter Dalgaard pdalgd at gmail.com
Fri Oct 8 08:29:49 CEST 2010


On 10/08/2010 06:55 AM, Jonathan DuBois wrote:
> Hi,
> 
> I have been using R to do multiple analyses of variance with two
> covariates, but recently found that the results in SPSS were very
> different. I have check several books and web resources and I think
> that both methods are correct, but I am less familiar with R, so I was
> hoping someone could offer some suggestions. Oddly simple ANOVA is the
> same in SPSS and R. Including covariates improves the main effect
> (p-value) in R and diminishes it in SPSS..
> 
> The formula I have been using is:
>> Y = cbind(dV1, dV2, dV3)
>> aov(lm(Y~iV1+cV1+cV2))

I wouldn't use aov() and lm() in combination like that. I'm a bit
surprised that it actually does something, in fact -- the argument to
aov() is documented to be a model formula and aov() is not a generic
function. Anyways, what you do get is sequential (type1) ANOVA for each
variable, and these depend on the order of terms in the model.

What I would do is explicitly to compare the the models with and without
the group effect:

fit1 <-  lm(Y~iV1+cV1+cV2)
fit2 <-  lm(Y~cV1+cV2)
anova(fit1, fit2)

which will give you a multivariate test of iV1 specifically.

> The main independent variable is disease group and the covariates are
> continuous nuisance variables such as age. Both nuisance variables
> interact with the dependent variable but not each other. The frequency
> distribution of the covariates is similar for each group, but the
> groups are not matched 1 to 1. Therefore we would like to control for
> these factors statistically. Is this the proper formula for such a
> test? If so, what might be cause of major discrepancy with SPSS?



-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list