[R] Anohter anova.mlm problem

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Jun 15 11:38:23 CEST 2005


"Bela Bauer" <bela_b at gmx.net> writes:

> Hi,
> 
> yet another anova.mlm problem - it doesn't seem to end.
> This time, I have a setup with a few within-subject factors and a
> between-subject factor (SGROUP). Consider the most simple case with only one
> within-factor (apo):
> 
> > mlmfit0 <- lm(data.n ~ 0 + SGROUP)
> > mlmfit1 <- lm(data.n ~ 1 + SGROUP)
> > anova(mlmfit1,mlmfit0,test="Spherical",M=~hemi,X=~1)
> Analysis of Variance Table
> 
> Model 1: data.n ~ 1 + SGROUP
> Model 2: data.n ~ 0 + SGROUP
> 
> Contrasts orthogonal to
> ~1
> 
> 
> Contrasts spanned by
> ~hemi
> 
> Greenhouse-Geisser epsilon: 0.6829
> Huynh-Feldt epsilon:        0.7127
> 
>   Res.Df Df Gen.var.   F num Df den Df Pr(>F) G-G Pr H-F Pr
> 1     22     0.54295
> 2     22  0  0.54295 Inf      0     44
> Warning messages:
> 1: NaNs produced in: pf(q, df1, df2, lower.tail, log.p)
> 2: NaNs produced in: pf(q, df1, df2, lower.tail, log.p)
> 3: NaNs produced in: pf(q, df1, df2, lower.tail, log.p)
> 
> 
> Now, those G-G and H-F epsilons it gives me are correct (at least G-G, the
> H-F seems to be affected by the R vs SAS difference in the calculation). But
> whatever happened to everything else?
> I've played around with the source in mlm.R, and it looks to be as though
> the problem is related to this:
> https://stat.ethz.ch/pipermail/r-devel/2005-April/032925.html
> 
> Is there a solution to this problem? Am I doing something wrong? The data
> looks like this:

You're fitting the same model twice, so you get zero DF for the
difference. If you want to compare a model with a difference between
the two groups to one with no difference (in the relevant contrasts),
you need to compare

 mlmfit0 <- lm(data.n ~ SGROUP)
 mlmfit1 <- lm(data.n ~ 1)


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list