MATH 314 Quiz 20
Given on 2025-11-12
Please submit a Jupyter notebook to the Quiz 20 repository by the end of class today.
-
Use Polars to read in the possum dataset and select the columns
pop,skullW, andtotalL. Remove any missing data (nulls). Here's the README for these data. Pay attention to units. -
Fit a linear model to predict
totalLusing the categorical variablepop. -
Calculate the group mean for the level
otherofpop. -
Calculate the group mean for the level
vicofpop. -
Use the method
conf_inton the object returned from the methodfitto calculate confidence intervals for the two coefficients from this linear model. -
Interpret each confidence interval in context of the data.
-
What does the confidence interval on
victell you about the mean total length of possum fromvicas opposed toother? -
Make a scatter plot of
totalL(y-axis) onskullW(x-axis). Label the axes and include units. -
Fit a linear model to predict
totalLusing the numeric variableskullW. -
Interpret in context of these data intercept.
-
The intercept in context of these data does not make sense. Why not?
-
Interpret in context of these data the slope.
-
Repeat the scatter plot above, but now add the fitted line to your plot.
-
Use the method
conf_inton the object returned from the methodfitto calculate confidence intervals for the two coefficients from this linear model. -
Use the function [scipy function
scipy.stats.pearsonr(x, y)] to calculate the correlation betweentotalLandskullW. Then calculate. Confirm the value of with the output from 9. -
What does the confidence interval on the slope tell you about these data?
-
Fit a linear model to predict
totalLusing the numeric variableskullWin a quadratic form. That is useskullWandskullW ** 2to predicttotalL. -
Which model, the linear one or the quadratic one, predicts more of the variation in
totalL? -
Which model, the linear one or the quadratic one, is a more realistic model for these data? Why?
-
Repeat the scatter plot above, but now add the fitted line and the fitted curve. Label each fit appropriately and add a legend.