MATH 314 Quiz 21
Given on 2025-11-17
Please submit a Jupyter notebook to the Quiz 21 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 unique intercepts (shared slope) linear model to predict
totalLusing the categorical variablepopand the numeric variableskullW. -
Use the method
predicton the class returned bysm.OLS(y, X).fit()to calculate the mean total length of possums from eachpop(otherandvic) for a possum with skull width equal to the mean of the appropriatepopfrom the model in 2. Interpret each mean in context of the data. -
Re-do the calculation in 3. without the method
predict, but you should use the propertyparamson the class returned bysm.OLS(y, X).fit(). -
Fit a unique intercepts and unique slope linear model to predict
totalLusing the categorical variablepopand the numeric variableskullW. -
Use the method
predicton the class returned bysm.OLS(y, X).fit()to calculate the mean total length of possums from eachpop(otherandvic) for a possum with skull width equal to the mean of the appropriatepopfrom the model in 4. Interpret each mean in context of the data. -
Re-do the calculation in 6. without the method
predict, but you should use the propertyparamson the class returned bysm.OLS(y, X).fit(). -
Pick a value of skull width from amongst the values of
skullWin the dataset. Make a prediction using the appropriate level ofpopfrom each model (2. and 5. above). Quantify how far from the matching value oftotalLis from your predictions. -
Which model predicts
totalLbetter? Why? -
Make a plot of either model for all levels of
pop.