Last active
October 7, 2019 18:38
-
-
Save monogenea/b0af63704c7af96105da2ea9079abdfa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dev.off() # Reset previous graphical pars | |
# New GLM, updated from the first by estimating with REML | |
GLM2 <- update(GLM, .~., method = "REML") | |
# Plot side by side, beta with respective SEs | |
plot(coef(GLM2), xlab = "Fixed Effects", ylab = expression(beta), axes = F, | |
pch = 16, col = "black", ylim = c(-.9,2.2)) | |
stdErrors <- coef(summary(GLM2))[,2] | |
segments(x0 = 1:6, x1 = 1:6, y0 = coef(GLM2) - stdErrors, y1 = coef(GLM2) + stdErrors, | |
col = "black") | |
axis(2) | |
abline(h = 0, col = "grey", lty = 2) | |
axis(1, at = 1:6, | |
labels = c("Intercept", "Rack", "Nutrient (Treated)","AMD (Unclipped)","Status (PP)", | |
"Status (Transplant)"), cex.axis = .7) | |
# LMM | |
points(1:6 + .1, fixef(finalModel), pch = 16, col = "red") | |
stdErrorsLMM <- coef(summary(finalModel))[,2] | |
segments(x0 = 1:6 + .1, x1 = 1:6 + .1, y0 = fixef(finalModel) - stdErrorsLMM, | |
y1 = fixef(finalModel) + stdErrorsLMM, col = "red") | |
# Legend | |
legend("topright", legend = c("GLM","LMM"), text.col = c("black","red"), bty = "n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment