MATH 315 Quiz 05
Due 2025-12-12 by 12:59pm
Consider the data set finches.
library(ggplot2)
suppressMessages(library(dplyr))
finches <- read.csv("https://raw.githubusercontent.com/roualdes/data/refs/heads/master/finches.csv")
ggplot(finches, aes(lowerbeaklength, upperbeaklength, color = island)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE)
fit <- lm(upperbeaklength ~ island * lowerbeaklength, data = finches)
summary(fit)
predict(fit,
newdata = data.frame(island="santacruz",
lowerbeaklength = 8.5),
interval = "confidence", conf.level = 0.98)
finches <- finches %>%
mutate(scz = as.numeric(island == "santacruz"))
fitl <- glm(scz ~ lowerbeaklength, data=finches, family = binomial())
summary(fitl)
fitl %>%
predict(newdata = data.frame(lowerbeaklength = c(8, 9)), type = "response") %>%
diff
min(finches$lowerbeaklength)
max(finches$lowerbeaklength)
fitl %>%
predict(newdata = data.frame(lowerbeaklength = c(6, 11)), type = "response")
-
Use
lowerbeaklength(measured in millimeters) andislandto predictupperbeaklength(measured in millimeters.)a. Interpret the slope on lowerbeaklength in context of the data.
b. What does the p-value on the row named
islandsancristobaltell you about these finches? Be specific.c. What does the p-value on the row named
lowerbeaklengthtell you about these finches? Be specific.d. Interpret in context of these data the confidence interval for the prediction.
e. Which is better $R^2$ or adjusted $R^2$?
f. What might you do to increase (not adjusted) $R^2$?
-
Use logistic regression and the variable
lowerbeaklength(measured in millimeters) to predict whether or not a finch is from the island Santa Cruz.a. Interpret, in context of the data, the slope on
lowerbeaklength. Be specific.b. Interpret, in context of the data, the two predictions. Are we able to reasonably predict a finch from the island Santa Cruz with this model. Why or why not? Justify your explanation using the output from the code.