[R] Estimated Effects Not Balanced

Justin Thong justinthong93 at gmail.com
Tue Aug 23 13:46:26 CEST 2016


Hi,

Thanks Richard,

That was me playing with too many examples and having too many variables
just lying around. Thanks for the tip though.

On 22 August 2016 at 23:32, Bert Gunter <bgunter.4567 at gmail.com> wrote:

> Thanks, Rich. I didn't notice that!
>
> -- Bert
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Mon, Aug 22, 2016 at 1:43 PM, Richard M. Heiberger <rmh at temple.edu>
> wrote:
> > The problem is that you have 12 observations and 1+2+10=13 degrees of
> freedom.
> > There should be 1 + 2 + 8 = 11 degrees of freedom.
> > Probably one of your variables is masked by something else in you
> workspace.
> > Protect yourself by using a data.frame
> >
> >> tmp <- data.frame(A=factor(c(1,1,1,1,1,1,2,2,2,2,2,2)),
> > + B=factor(c(1,1,2,2,3,3,1,1,2,2,3,3)),
> > + y=rnorm(12))
> >> mod <- aov(y ~ A+B, data=tmp)
> >> summary(mod)
> >             Df Sum Sq Mean Sq F value Pr(>F)
> > A            1  1.553   1.553   1.334  0.281
> > B            2  3.158   1.579   1.357  0.311
> > Residuals    8  9.311   1.164
> >
> > On Mon, Aug 22, 2016 at 11:15 AM, Justin Thong <justinthong93 at gmail.com>
> wrote:
> >> Something does not make sense in R. It has to do with the question of
> >> balance and unbalance.
> >>
> >> *A<-factor(c(1,1,1,1,1,1,2,2,2,2,2,2))*
> >> *B<-factor(c(1,1,2,2,3,3,1,1,2,2,3,3))*
> >> *y<-rnorm(12)*
> >> *mod<-aov(y~A+B)*
> >>
> >> I was under the impression that the design is balanced ie order does not
> >> effect the sums of squares. However, when I compute the anova R reports
> >> that the Estimated Effects are Unbalanced. I thought that when all
> >> combinations of levels of A and B have equal replications then the
> design
> >> is called balanced. But, R tends to think that when not all levels of A
> and
> >> levels of B have equal replication, then the "Estimated Effects are
> >> unbalanced".... Is this the same as the design being unbalanced? Because
> >> for the example below, where the error occured, the order does not
> matter
> >> (which make me think that the design is balanced).
> >>
> >>
> >> *Call:*
> >> *   aov(formula = y ~ A + B)*
> >>
> >> *Terms:*
> >> *                        A         B Residuals*
> >> *Sum of Squares   0.872572  0.025604 16.805706*
> >> *Deg. of Freedom         1         2        10*
> >>
> >> *Residual standard error: 1.296368*
> >> *Estimated effects may be unbalanced*
> >> --
> >> Yours sincerely,
> >> Justin
> >>
> >> *I check my email at 9AM and 4PM everyday*
> >> *If you have an EMERGENCY, contact me at +447938674419(UK) or
> >> +60125056192(Malaysia)*
> >>
> >>         [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>



-- 
Yours sincerely,
Justin

*I check my email at 9AM and 4PM everyday*
*If you have an EMERGENCY, contact me at +447938674419(UK) or
+60125056192(Malaysia)*

	[[alternative HTML version deleted]]



More information about the R-help mailing list