Reputation: 1
I'm trying to plot a bar chart with standard error bars using lsmeans, but I keep getting the same error message:
Error in FUN(X[[i]], ...) : object 'lsmean' not found
I've tried all sorts of different codes to achieve this and never manage to do it.
My model is:
model<-lmer(data=data, Y~X1+X2+X3+X4+(1|Individual))
My lsmeans code (I have back transformed the data after a log transformation on Y:
lsmeans(model,
~ X1,
adjust="tukey")
X1.post <- lsmeans(model, pairwise ~ X1, type = "response")
X1.post
The code I have just tried is:
ggplot(data) +
geom_bar( aes(x=X1, y=lmean), stat="identity", fill="skyblue", alpha=0.5) +
geom_crossbar( aes(x=X1, y=lsmean, ymin=lsmean-se, ymax=lsmean+se), width=0.4, colour="orange", alpha=0.9, size=1.3)
I want to report the lsmeans for X1
which has 5 levels. Please could anyone advise on which code I can use for this purpose?
Upvotes: 0
Views: 239