HW05: linear regressions#

DEADLINE: Wednesday, November 5th, 2025

Compute and analyze linear regressions#

Compute each of the following regressions (“Y against X” means you regress Y onto X):

  • [ ] annual block maximum precipitation against daily mean temperature averaged over May through September of each year

  • [ ] snow fall against daily maximum temperature, both restricting to days in December through February

  • [ ] same, but also restricting to days with nonzero snowfall

For each of these, include each of the following:

  • [ ] the Pearson correlation coefficient

  • [ ] the regression slope value, including the units

  • [ ] the regression intercept value, including the units

  • [ ] a scatterplot of the two variables with the regression line overlaid

  • [ ] a ~2 sentence analysis of your interpretation of the results of the regression

Implement detrending#

First, write a python function that uses linear regression to compute and return the linear trend in time of a given variable.

Second, write another function that calls the above function to compute the trend, and then subtracts off that trend from the original array. The function should return this resulting detrended array.

Third, for the two variables used in the first linear regression above (block-max precip and warm-season mean temp), plot the original timeseries, the detrended timeseries, and the linear trend. These should all go in one 2-panel figure, one panel per variable. Include a brief summary for each variable of your interpretion of the resuls of the detrending.

Fourth, repeat the linear regression tasks but using the detrended timeseries. Describe how much the results change or not.

Extra credit opportunities#

Apply these tools to your final project#

Complete the linear regression and detrending tasks above for a pair of variables from the dataset you’re using for your final project.

Notice: the trend/detrending logic above assumes timeseries. If your data are not timeseries, you can still do this…just make the trend/detrending code accept the name of whatever dimension that your data varies over.

How to submit#

Use the Google form here.