[R] Converting SAS Code

Andrew Harmon andrewharmon42 at gmail.com
Wed Oct 11 20:33:24 CEST 2017

I have no problem setting up my mixed model, or performing anova or lsmeans
on my model’s outputs. However, performing lsd mean separation is giving me

So I do not have a problem when using two-way anova model. When using the

fit.yield.add <- lm(data = ryzup, Yield ~ Rep + Nitrogen + Treatment)

LSD.test(fit.yield.add, trt = "Nitrogen", alpha = 0.1, console = TRUE)

It works beautifully. However when I run a mixed model:

yield.lmer <- lmer(data = ryzup, Yield ~ Nitrogen + Treatment +
(1|Rep/Nitrogen), REML = FALSE)

LSD.test(yield.lmer, trt = "Nitrogen", alpha = 0.1, console = TRUE)

It gives me fits. It produces errors like:

Error in as.data.frame.default(x[[i]], optional = TRUE) :

  cannot coerce class "structure("merModLmerTest", package = "lmerTest")"
to a data.frame

Do you have any suggestions for that?


	[[alternative HTML version deleted]]

More information about the R-help mailing list