Exercise

Variation in Two Parts

Given two data sets of distance-versus-time data, one with very small velocity and one with large velocity. Notice that both may have the same standard error of slope, but different R-squared for the model overall, depending on the size of the slope ("effect size") as compared to the standard error ("uncertainty").

If we plot both data sets as scatter plots on the same axes, the contrast is clear. Variation due to the slope is different than variation due to the random scatter about the trend line. In this exercise, your goal is to compute the standard error and R-squared for two data sets and compare.

Instructions

100 XP
  • Build and fit() an ols() model, for both data sets distances1 and distances2.
  • Use the .bse of resulting models model_1 and model_2, and the 'times' key to extract the standard error values for the slope from each model.
  • Use the .rsquared attribute to extract the R-squared value from each model.
  • Print the resulting se_1, rsquared_1, se_2, rsquared_2, and visually compare.