[R] Why aov() with Error() gives three strata?
Bert Gunter
bgunter.4567 at gmail.com
Thu Dec 28 19:04:33 CET 2017
Jorge:
FYI, *generally speaking,* queries that are mostly statistical in
nature, such as yours, are off topic here -- this list is about R
programming help, not statistical help. Having said that, you still
may get a useful response here -- the r-help/statistics intersection
*is* nonempty. However, if not, 2.5 suggestions:
1. Try posting to r-sig-mixed-models instead. Repeated measures are a
type of mixed/multilevel model and you may receive some useful
suggestions there, including alternative R approaches to fitting such
model (e.g. using lme() or lmer() ).
2. Alternatively, try posting to a statistics site like stats.stackexchange.com.
2.5. Or, if you can, the best idea might be to sit down with a local
statistics expert.
Cheers,
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 Thu, Dec 28, 2017 at 7:52 AM, Jorge Fernando Saraiva de Menezes
<jorgefernandosaraiva at gmail.com> wrote:
> Dear list users,
>
> I am trying to learn Repeated measures ANOVA using the aov() interface, but
> I'm struggling to understand its output.
>
> According to tutorials on the web, formula for a repeated measures design
> is:
>
> aov(Y ~ IV+ Error(SUBJECT/IV) )
>
> This formula does work but it returns three strata (Error:SUBJECT, Error:
> SUBJECT:IV, Error: Within), when I would expect two strata (Within and
> Between subjects). I've seems some tutorials show the exactly same setup,
> but returning only the two first strata.
>
> Is it possible to have two or three strata depending on the data?
> If there is always three strata, how this would fit the interpretation of
> between vs within effects?
>
> Below a reproducible example that gives three strata:
>
> data(beavers)
> data=data.frame(id =
> rep(c("beaver1","beaver2"),c(nrow(beaver1),nrow(beaver2))),rbind(beaver1,beaver2))
> data$activ=factor(data$activ)
> #balance dataset to have 6 samples for every combination of beaver and
> activity.
> balanced = split(data,interaction(data$id,data$activ))
> sizes = sapply(balanced,nrow)
> selected = lapply(sizes,sample.int,6)
> balanced = mapply(function(x,y) {x[y,]}, balanced,selected,SIMPLIFY=F)
> balanced = do.call(rbind,balanced)
> aov(temp~activ+Error(id/activ),data=balanced)
>
> Thanks,
> Jorge
>
> [[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.
More information about the R-help
mailing list