0

I did a nested ANOVA for my Data. For that, I tried to orientate on the example on this page:

https://rcompanion.org/rcompanion/d_07.html

My Data looks like this:

Treatment    Group    Donation
1              1         0
1              1         1.2
1              2         0.3
1              2         0.7
2              1         0.1
2              1         1
2              2         0
2              2         0.7

I was able to perform the nested ANOVA as described on the page, but struggle to get the Post hoc test done:

library(multcomp)
posthoc = glht(model,
               linfct = mcp(Treatment="Tukey"))
mcs = summary(posthoc,
              test=adjusted("single-step"))
mcs

This is the output I get:

> library(multcomp)
> posthoc = glht(model,
+                linfct = mcp(Treatment="Tukey"))
Error in `[.data.frame`(mf, nhypo[checknm]) : undefined columns selected
> mcs = summary(posthoc,
+               test=adjusted("single-step"))
Error in summary(posthoc, test = adjusted("single-step")) : 
  object 'posthoc' not found
> mcs
Error: object 'mcs' not found
Anonymosaurus
  • 99
  • 1
  • 9
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. How was `model` created? – MrFlick Feb 13 '20 at 16:27
  • Hi, I will keep that in mind for the next time. I created model using this code: model = lme(Donation ~ Treatment, random=~1|Session, data=Auswertungen_latest, method="REML") – Anonymosaurus Feb 13 '20 at 16:30
  • You seem to have `Session` in your model but that doesn't appear in your data. Where does that come from? – MrFlick Feb 13 '20 at 16:32
  • Ah, that's my fault, the header is group, the variable name is session. So its like this: Session <- Data$Group – Anonymosaurus Feb 13 '20 at 16:35
  • 3
    No need to keep in mind for next time—you can [edit] the question to include more information – camille Feb 13 '20 at 16:50
  • I wanted to create a reproducible example, but get an error when running the ANOVA: my code: **model = lme(Donation ~ Treatment, random=~1|Session, + data=Auswertungen_latest, + method="REML")** The output: **> library(nlme) > model = lme(Donation ~ Treatment, random=~1|Session, + + data=Auswertungen_latest, Error: unexpected '=' in: "model = lme(Donation ~ Treatment, random=~1|Session, + data=" > + method="REML") Error: unexpected ')' in " + method="REML")"** – Anonymosaurus Feb 14 '20 at 06:50

0 Answers0