setwd("M:/web/17C - 2018/scripts")
library(tidyverse)
stag <- read.table("../data/stag.txt", header = T) str(stag)
ggplot(stag, aes(x = jh, y = mand) ) + geom_point()
summary(stag)
mod <- lm(data = stag, mand ~ jh) summary(mod)
plot(mod, which = 1)
hist(mod$residuals)
shapiro.test(mod$residuals)
intercept <- mod$coefficients[1] intercept
slope <- mod$coefficients[2] slope
jh <- 15 slope * jh + intercept
newdata <- data.frame(jh = seq(10, 30, 5)) newdata$predictedman <- predict(mod, newdata = newdata)
ggplot(stag, aes(x = jh, y = mand) ) + geom_point() + geom_smooth(method = lm, se = FALSE, colour = "black") + ylab("Mandible size (mm)") + ylim(0, 2) + xlim(0, 32) + xlab("Juvenile hormone (arbitrary units)") + theme_classic()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.