MATH 315 Homework 09
Due 2025-11-12 by 11:59pm
-
Load the dataset on donkeys. Our goal is to predict
Weight(kg) using bothSexandHeight(cm).a. Perform step 1 of any regression analysis, using
ggplot2. Please color the points bySex.You don't have to draw the linear regression lines if you don't want to, especially because doing so for the unique intercepts (per level of
Sex) and shared slope (across all levels ofSex) is unfortunately challenging.b. Produce the code to fit the linear regression model to predict
Weightusing bothSexandHeightthat gives unique intercepts to each level ofSexand a shared slope acrossHeightfor all levels ofSex.c. Make a data frame that stores the standardized residuals and fitted values from this model.
d. Make a ggplot2 scatter plot of the standardized residuals (y-axis) on the fitted values (x-axis). What assupmtions of linear regression does this plot help us check? Do the assumptions seem reasonably met? Why or why not?
e. Make a ggplot2 histogram of the standardized residuals. What assumption of linear regression does this help us check? Does the assumption seem reasonably met? Why or why not?
f. Are there any potential outliers that we need to be concerned with? Explain.
Theoretically, if the assumptions of linear regression aren't satisfactorily met, you'd adjust your model and try again.g. Use adjusted R-squared to determine if including
Sexas an explanatory variable improves the overall model fit, as compared to not includingSex. Report two adjusted R-squared numbers to justify your conclusion.h. Calculate the unique intercepts for each level of
Sex.i. Interpret an intercept for a level of
Sexin context of the data. Does this intercept value make logical sense?j. Interpret the slope in context of the data. Please be specific about which levels of
Sexthis slope is referring to.k. Using the p-values for the intercepts/offsets, what can you say about the differences between the
Sex's weights?