Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

In the last lecture, we started discussing nonlinear regression models. As a motivating example, we considered the following dataset (from FRED) on Annual Estimates of the Resident Population of California (units are thousands of persons) from 1900 to 2024.

  observation_date   CAPOP
0       1900-01-01  1490.0
1       1901-01-01  1550.0
2       1902-01-01  1623.0
3       1903-01-01  1702.0
4       1904-01-01  1792.0
5       1905-01-01  1893.0
6       1906-01-01  1976.0
7       1907-01-01  2054.0
8       1908-01-01  2161.0
9       1909-01-01  2282.0
    observation_date      CAPOP
116       2016-01-01  39149.186
117       2017-01-01  39337.785
118       2018-01-01  39437.463
119       2019-01-01  39437.610
120       2020-01-01  39527.808
121       2021-01-01  39152.927
122       2022-01-01  39125.347
123       2023-01-01  39181.667
124       2024-01-01  39364.774
125       2025-01-01  39355.309
<Figure size 640x480 with 1 Axes>

We work with the logarithms of the population data as this will lead to models with better interpretability.

<Figure size 640x480 with 1 Axes>

We shall fit the following model to this dataset:

yt=β0+β1(t−1)+β2(t−2)++β3(t−3)++⋯+βn−1(t−(n−1))++ϵty_t = \beta_0 + \beta_1 (t - 1) + \beta_2 (t - 2)_+ + \beta_3 (t - 3)_+ + \dots + \beta_{n-1} (t - (n-1))_+ + \epsilon_t

We can write this as

y=Xfullβ+ϵy = X_{\text{full}} \beta + \epsilon

where XfullX_{\text{full}} is constructed as below.

[[  1.   0.  -0. ...  -0.  -0.  -0.]
 [  1.   1.   0. ...  -0.  -0.  -0.]
 [  1.   2.   1. ...  -0.  -0.  -0.]
 ...
 [  1. 123. 122. ...   1.   0.  -0.]
 [  1. 124. 123. ...   2.   1.   0.]
 [  1. 125. 124. ...   3.   2.   1.]]

If we fit this model without any regularization, we get the following.

                            OLS Regression Results                            
==============================================================================
Dep. Variable:                  CAPOP   R-squared:                       1.000
Model:                            OLS   Adj. R-squared:                    nan
Method:                 Least Squares   F-statistic:                       nan
Date:                Thu, 01 Oct 2026   Prob (F-statistic):                nan
Time:                        19:05:42   Log-Likelihood:                 3207.8
No. Observations:                 126   AIC:                            -6164.
Df Residuals:                       0   BIC:                            -5806.
Df Model:                         125                                         
Covariance Type:            nonrobust                                         
==============================================================================
                 coef    std err          t      P>|t|      [0.025      0.975]
------------------------------------------------------------------------------
const          7.3065        inf          0        nan         nan         nan
x1             0.0395        inf          0        nan         nan         nan
x2             0.0065        inf          0        nan         nan         nan
x3             0.0015        inf          0        nan         nan         nan
x4             0.0040        inf          0        nan         nan         nan
x5             0.0033        inf          0        nan         nan         nan
x6            -0.0119        inf         -0        nan         nan         nan
x7            -0.0042        inf         -0        nan         nan         nan
x8             0.0121        inf          0        nan         nan         nan
x9             0.0037        inf          0        nan         nan         nan
x10           -0.0016        inf         -0        nan         nan         nan
x11           -0.0011        inf         -0        nan         nan         nan
x12           -0.0003        inf         -0        nan         nan         nan
x13            0.0007        inf          0        nan         nan         nan
x14           -0.0094        inf         -0        nan         nan         nan
x15           -0.0179        inf         -0        nan         nan         nan
x16           -0.0042        inf         -0        nan         nan         nan
x17            0.0113        inf          0        nan         nan         nan
x18           -0.0038        inf         -0        nan         nan         nan
x19           -0.0050        inf         -0        nan         nan         nan
x20            0.0391        inf          0        nan         nan         nan
x21            0.0032        inf          0        nan         nan         nan
x22           -0.0153        inf         -0        nan         nan         nan
x23            0.0172        inf          0        nan         nan         nan
x24           -0.0060        inf         -0        nan         nan         nan
x25           -0.0208        inf         -0        nan         nan         nan
x26            0.0004        inf          0        nan         nan         nan
x27            0.0021        inf          0        nan         nan         nan
x28           -0.0057        inf         -0        nan         nan         nan
x29           -0.0032        inf         -0        nan         nan         nan
x30           -0.0024        inf         -0        nan         nan         nan
x31           -0.0124        inf         -0        nan         nan         nan
x32           -0.0076        inf         -0        nan         nan         nan
x33           -0.0003        inf         -0        nan         nan         nan
x34            0.0045        inf          0        nan         nan         nan
x35            0.0027        inf          0        nan         nan         nan
x36            0.0077        inf          0        nan         nan         nan
x37            0.0025        inf          0        nan         nan         nan
x38           -0.0096        inf         -0        nan         nan         nan
x39           -0.0002        inf         -0        nan         nan         nan
x40            0.0048        inf          0        nan         nan         nan
x41            0.0164        inf          0        nan         nan         nan
x42            0.0261        inf          0        nan         nan         nan
x43            0.0285        inf          0        nan         nan         nan
x44           -0.0447        inf         -0        nan         nan         nan
x45           -0.0067        inf         -0        nan         nan         nan
x46           -0.0209        inf         -0        nan         nan         nan
x47            0.0054        inf          0        nan         nan         nan
x48           -0.0048        inf         -0        nan         nan         nan
x49            0.0034        inf          0        nan         nan         nan
x50            0.0056        inf          0        nan         nan         nan
x51            0.0095        inf          0        nan         nan         nan
x52            0.0021        inf          0        nan         nan         nan
x53            0.0076        inf          0        nan         nan         nan
x54           -0.0120        inf         -0        nan         nan         nan
x55           -0.0097        inf         -0        nan         nan         nan
x56            0.0133        inf          0        nan         nan         nan
x57           -0.0038        inf         -0        nan         nan         nan
x58            0.0029        inf          0        nan         nan         nan
x59           -0.0036        inf         -0        nan         nan         nan
x60           -0.0130        inf         -0        nan         nan         nan
x61            0.0130        inf          0        nan         nan         nan
x62           -0.0045        inf         -0        nan         nan         nan
x63         5.425e-05        inf          0        nan         nan         nan
x64           -0.0073        inf         -0        nan         nan         nan
x65           -0.0033        inf         -0        nan         nan         nan
x66           -0.0090        inf         -0        nan         nan         nan
x67            0.0021        inf          0        nan         nan         nan
x68           -0.0054        inf         -0        nan         nan         nan
x69            0.0049        inf          0        nan         nan         nan
x70           -0.0031        inf         -0        nan         nan         nan
x71            0.0055        inf          0        nan         nan         nan
x72           -0.0069        inf         -0        nan         nan         nan
x73            0.0020        inf          0        nan         nan         nan
x74            0.0008        inf          0        nan         nan         nan
x75            0.0025        inf          0        nan         nan         nan
x76            0.0013        inf          0        nan         nan         nan
x77            0.0005        inf          0        nan         nan         nan
x78            0.0026        inf          0        nan         nan         nan
x79           -0.0031        inf         -0        nan         nan         nan
x80            0.0049        inf          0        nan         nan         nan
x81           -0.0029        inf         -0        nan         nan         nan
x82            0.0016        inf          0        nan         nan         nan
x83           -0.0002        inf         -0        nan         nan         nan
x84           -0.0026        inf         -0        nan         nan         nan
x85            0.0039        inf          0        nan         nan         nan
x86            0.0019        inf          0        nan         nan         nan
x87        -9.855e-05        inf         -0        nan         nan         nan
x88           -0.0002        inf         -0        nan         nan         nan
x89            0.0017        inf          0        nan         nan         nan
x90           -0.0014        inf         -0        nan         nan         nan
x91           -0.0094        inf         -0        nan         nan         nan
x92           -0.0003        inf         -0        nan         nan         nan
x93           -0.0063        inf         -0        nan         nan         nan
x94           -0.0033        inf         -0        nan         nan         nan
x95            0.0002        inf          0        nan         nan         nan
x96            0.0035        inf          0        nan         nan         nan
x97            0.0046        inf          0        nan         nan         nan
x98            0.0007        inf          0        nan         nan         nan
x99           -0.0003        inf         -0        nan         nan         nan
x100           0.0111        inf          0        nan         nan         nan
x101          -0.0108        inf         -0        nan         nan         nan
x102          -0.0030        inf         -0        nan         nan         nan
x103          -0.0004        inf         -0        nan         nan         nan
x104          -0.0018        inf         -0        nan         nan         nan
x105          -0.0020        inf         -0        nan         nan         nan
x106          -0.0017        inf         -0        nan         nan         nan
x107           0.0010        inf          0        nan         nan         nan
x108           0.0034        inf          0        nan         nan         nan
x109         -1.6e-05        inf         -0        nan         nan         nan
x110       -5.495e-05        inf         -0        nan         nan         nan
x111          -0.0012        inf         -0        nan         nan         nan
x112          -0.0003        inf         -0        nan         nan         nan
x113       -4.045e-05        inf         -0        nan         nan         nan
x114           0.0005        inf          0        nan         nan         nan
x115          -0.0005        inf         -0        nan         nan         nan
x116          -0.0019        inf         -0        nan         nan         nan
x117          -0.0015        inf         -0        nan         nan         nan
x118          -0.0023        inf         -0        nan         nan         nan
x119          -0.0025        inf         -0        nan         nan         nan
x120           0.0023        inf          0        nan         nan         nan
x121          -0.0118        inf         -0        nan         nan         nan
x122           0.0088        inf          0        nan         nan         nan
x123           0.0021        inf          0        nan         nan         nan
x124           0.0032        inf          0        nan         nan         nan
x125          -0.0049        inf         -0        nan         nan         nan
==============================================================================
Omnibus:                     3889.456   Durbin-Watson:                   0.002
Prob(Omnibus):                  0.000   Jarque-Bera (JB):               13.618
Skew:                          -0.149   Prob(JB):                      0.00110
Kurtosis:                       1.417   Cond. No.                     1.81e+04
==============================================================================

Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
[2] The condition number is large, 1.81e+04. This might indicate that there are
strong multicollinearity or other numerical problems.
/Users/aditya/mambaforge/envs/stat153fall2026/lib/python3.14/site-packages/statsmodels/regression/linear_model.py:1795: RuntimeWarning: divide by zero encountered in divide
  return 1 - (np.divide(self.nobs - self.k_constant, self.df_resid)
/Users/aditya/mambaforge/envs/stat153fall2026/lib/python3.14/site-packages/statsmodels/regression/linear_model.py:1795: RuntimeWarning: invalid value encountered in scalar multiply
  return 1 - (np.divide(self.nobs - self.k_constant, self.df_resid)
/Users/aditya/mambaforge/envs/stat153fall2026/lib/python3.14/site-packages/statsmodels/regression/linear_model.py:1717: RuntimeWarning: divide by zero encountered in scalar divide
  return np.dot(wresid, wresid) / self.df_resid

In this unregularized estimation, the estimate of β0\beta_0 equals y1y_1, the estimate of β1\beta_1 is y2−y1y_2 - y_1, and the estimate of βj\beta_j is yj+1−2yj+yj−1y_{j+1} - 2 y_j + y_{j-1} for j=2,…,n−1j = 2, \dots, n-1. Let us check this.

7.306531398939505 7.306531398939486
0.03947881097378758 0.03947881097380328
0.006542546627510859 0.00654254662752654
0.0015063840174303067 0.0015063840174089499
0.004000542782827132 0.004000542782759602

Ridge and LASSO regularized estimation

We now compute the ridge and lasso regularized estimators using the optimization library cvxpy. cvxpy is a library for formulating and solving convex optimization problems. It is widely used in Machine Learning, Statistics, Engineering etc.

Here is the function for solving the ridge optimization problem. Given yn×1y_{n \times 1}, Xn×mX_{n \times m} and λ\lambda, this code solves the problem:

Minimize [∥y−Xβ∥2+λ(βs2+⋯+βm2)]\begin{align*} \text{Minimize} ~ \left[\|y - X \beta\|^2 + \lambda (\beta_s^2 + \dots + \beta_m^2) \right] \end{align*}

Here ss denotes penalty_start in the code (the penalty does not involve βj\beta_j for j<sj < s).

Below is the code for computing the ridge estimator with a fixed value of λ\lambda. We also plot the fitted values (these are the values μ^ridge(λ)=Xβ^ridge(λ)\hat{\mu}^{\text{ridge}}(\lambda) = X \hat{\beta}^{\text{ridge}}(\lambda)) corresponding to the Ridge estimate.

Play around with different values of λ\lambda and see how the estimator changes.

<Figure size 640x480 with 1 Axes>

Here is the function for minimizing the LASSO objective function. Given yn×1y_{n \times 1}, Xn×mX_{n \times m} and λ\lambda, this code solves the problem:

Minimize [∥y−Xβ∥2+λ(∣βs∣+⋯+∣βm∣)]\begin{align*} \text{Minimize} ~ \left[\|y - X \beta\|^2 + \lambda (|\beta_s| + \dots + |\beta_m|) \right] \end{align*}

Here ss denotes penalty_start in the code (the penalty does not involve βj\beta_j for j<sj < s).

Below is the code for computing the ridge estimator with a fixed value of λ\lambda. We also plot the fitted values (these are the values μ^lasso(λ)=Xβ^lasso(λ)\hat{\mu}^{\text{lasso}}(\lambda) = X \hat{\beta}^{\text{lasso}}(\lambda)) corresponding to the Ridge estimate.

Play around with different values of λ\lambda and see how the estimator changes.

<Figure size 640x480 with 1 Axes>

The LASSO estimator is typically sparse. This can be checked by the code below where we only display the estimated coefficients which cross a threshold in absolute value.

[ 7.35726177e+00  4.18060682e-02 -6.26223822e-03 -8.13745455e-03
 -8.31087995e-03 -7.35145027e-05 -8.35702636e-03 -1.18955749e-03]
Index 0: 7.357261773551294
Index 1: 0.041806068247922414
Index 27: -0.0062622382150850356
Index 64: -0.00813745454741311
Index 65: -0.008310879947738404
Index 93: -7.351450270850918e-05
Index 94: -0.008357026361513361
Index 101: -0.0011895574866604035

Below we plot both the ridge and LASSO fits.

<Figure size 640x480 with 1 Axes>

The two fitted values seem quite similar.

Fitting Smooth Trend Functions to Data

These models and the corresponding Ridge and LASSO estimators are useful for fitting trend functions to data.

The following dataset (taken from NOAA climate at a glance) gives the average monthly temperatures for California from January 1895 to August 2026.

      year  month  value
0     1895      1   40.5
1     1895      2   46.0
2     1895      3   47.8
3     1895      4   53.7
4     1895      5   61.3
...    ...    ...    ...
1575  2026      4   56.1
1576  2026      5   64.0
1577  2026      6   72.4
1578  2026      7   77.6
1579  2026      8   79.0

[1580 rows x 3 columns]
<Figure size 1000x500 with 1 Axes>

Instead of the raw temperature averages, we shall work with temperature anomalies: for each calendar month (January, …, December) we compute California’s average temperature for that calendar month over 1901–2000, and the anomaly for any month in the dataset is the recorded value minus this baseline for its own calendar month. An anomaly of +1.2 in July 2026 means that July 2026 was 1.2°C warmer than a typical twentieth-century July.

The reason for looking at anomalies is that the raw series is dominated by the seasonal cycle (about 20°C between January and July, roughly 95% of the variance), which is a known repeating pattern and not what we want to study. Subtracting each calendar month’s baseline removes it and puts all months on the same footing, so what remains is month-to-month weather variability, which we treat as noise, plus any slow change in the climate, which is the trend we want to estimate.

   year  month  value       date   anomaly
0  1895      1   40.5 1895-01-01 -1.012222
1  1895      2   46.0 1895-02-01  0.369444
2  1895      3   47.8 1895-03-01 -0.541667
3  1895      4   53.7 1895-04-01 -0.175000
4  1895      5   61.3 1895-05-01  0.308333
<Figure size 1000x500 with 1 Axes>

We shall now fit a trend function to this anomaly data, using our high-dimensional linear regression model. The first step is to create the X matrix.

[[ 1.000e+00  0.000e+00 -0.000e+00 ... -0.000e+00 -0.000e+00 -0.000e+00]
 [ 1.000e+00  1.000e+00  0.000e+00 ... -0.000e+00 -0.000e+00 -0.000e+00]
 [ 1.000e+00  2.000e+00  1.000e+00 ... -0.000e+00 -0.000e+00 -0.000e+00]
 ...
 [ 1.000e+00  1.577e+03  1.576e+03 ...  1.000e+00  0.000e+00 -0.000e+00]
 [ 1.000e+00  1.578e+03  1.577e+03 ...  2.000e+00  1.000e+00  0.000e+00]
 [ 1.000e+00  1.579e+03  1.578e+03 ...  3.000e+00  2.000e+00  1.000e+00]]

The ridge regression estimate is computed below. Start with some standard choice of λ\lambda (e.g., λ=1\lambda = 1) and then increase or decrease it by factors of 10 until you get a fit that is visually nice (smooth while capturing patterns in the data).

<Figure size 1000x500 with 1 Axes>

We repeat the exercise with LASSO below.

<Figure size 1000x500 with 1 Axes>
<Figure size 1000x500 with 1 Axes>

Shrinkage and Sparsity

Let us compare the ridge regularized estimates of β\beta with the unregularized estimates (unregularized means λ=0\lambda = 0).

1.3816666666639175 -0.0004103633144908969
-1.012222222220763 -0.3492053868879078
<Figure size 640x480 with 1 Axes>

Note that the yy-axis above has a much tighter range compared to the xx-axis. This illustrates the shrinkage aspect of ridge regression. It shrinks the unregularized estimates towards zero.

1.3816666666667305 0.0005578030685411052
-1.0122222222222297 -0.4226540221392625
<Figure size 640x480 with 1 Axes>

This plot clearly shows that the LASSO sets most coefficients exactly to zero. Compare this plot to the corresponding plot for the ridge estimator. This means that LASSO is setting most of the βj\beta_j’s to zero. This is referred to as sparsity.

Ridge estimation results in shrinkage and LASSO estimation results in sparsity.

Cross-validation for picking λ\lambda

We use the following code for Cross-Validation for picking λ\lambda in ridge regression.

We need to select a set of candidate values for λ\lambda for using the above CV function. For this candidate set of values, we take a coarse grid comprising of 10a10^a where aa is some subset of values in {−10,…,10}\{-10, \dots, 10\}. If the minimizing λ\lambda appears at the endpoints of this grid, then the grid can be enlarged suitably.

100000000.0
Lambda = 10000.00, CV Error = 21.523288
Lambda = 100000.00, CV Error = 3.183640
Lambda = 1000000.00, CV Error = 2.486844
Lambda = 10000000.00, CV Error = 1.948602
Lambda = 100000000.00, CV Error = 1.769726
Lambda = 1000000000.00, CV Error = 1.787015
Lambda = 10000000000.00, CV Error = 1.808539

Below is the version of this code for LASSO.

1000
Lambda = 10.00, CV Error = 213.800543
Lambda = 100.00, CV Error = 11.690666
Lambda = 1000.00, CV Error = 1.785692
Lambda = 10000.00, CV Error = 1.800242
Lambda = 100000.00, CV Error = 1.847047

Simulated Data

One application of this model is to compare the trend functions underlying two time series datasets, especially when the time series are sufficiently noisy that the underlying trend cannot be gleaned by directly looking at the data. We first demonstrate this in a simulation example, and then give a couple of real examples.

I am simulating two time series datasets (of the same size n=1000n = 1000) using the code below.

Here are the two datasets plotted.

<Figure size 600x400 with 2 Axes>
<Figure size 640x480 with 1 Axes>

Each of these datasets is generated by taking a smooth function, and adding noise to it. The smooth functions which generated the data are shown below.

<Figure size 640x480 with 1 Axes>

These smooth functions (which generated the data) are clearly different. These differences are not easy to see however when we look at the raw data directly because of noise. We can use our trend estimates (based on ridge and lasso) to denoise the data so that they become comparable.

[[  1.   0.  -0. ...  -0.  -0.  -0.]
 [  1.   1.   0. ...  -0.  -0.  -0.]
 [  1.   2.   1. ...  -0.  -0.  -0.]
 ...
 [  1. 997. 996. ...   1.   0.  -0.]
 [  1. 998. 997. ...   2.   1.   0.]
 [  1. 999. 998. ...   3.   2.   1.]]
1000000.0
1000000.0
<Figure size 640x480 with 1 Axes>
1000.0
1000.0
<Figure size 640x480 with 1 Axes>
<Figure size 640x480 with 1 Axes>

Anomalies: CA vs AL

As a real data example, we compare the temperature anomalies data between two states (CA and AL).

      year  month  value
0     1895      1   43.1
1     1895      2   37.4
2     1895      3   54.5
3     1895      4   63.4
4     1895      5   69.5
...    ...    ...    ...
1575  2026      4   67.0
1576  2026      5   70.5
1577  2026      6   77.8
1578  2026      7   81.7
1579  2026      8   81.7

[1580 rows x 3 columns]
<Figure size 1000x500 with 1 Axes>
<Figure size 1000x800 with 2 Axes>

Both plots in one figure.

<Figure size 1000x500 with 1 Axes>

We focus on anomalies as opposed to the raw temperatures.

<Figure size 1000x800 with 2 Axes>

Here are both the anomalies plotted in one plot.

<Figure size 1000x500 with 1 Axes>

It is difficult to compare them directly. Here the trend functions give a useful comparison.

[[ 1.000e+00  0.000e+00 -0.000e+00 ... -0.000e+00 -0.000e+00 -0.000e+00]
 [ 1.000e+00  1.000e+00  0.000e+00 ... -0.000e+00 -0.000e+00 -0.000e+00]
 [ 1.000e+00  2.000e+00  1.000e+00 ... -0.000e+00 -0.000e+00 -0.000e+00]
 ...
 [ 1.000e+00  1.577e+03  1.576e+03 ...  1.000e+00  0.000e+00 -0.000e+00]
 [ 1.000e+00  1.578e+03  1.577e+03 ...  2.000e+00  1.000e+00  0.000e+00]
 [ 1.000e+00  1.579e+03  1.578e+03 ...  3.000e+00  2.000e+00  1.000e+00]]
100000000.0
100000000.0
<Figure size 1000x500 with 1 Axes>

California has warmed somewhat consistently since the 60s. But Alabama actually cooled down for a period before steady warming.

1000.0
1000.0
<Figure size 1000x500 with 1 Axes>
<Figure size 1000x500 with 1 Axes>

In this example, ridge regularization seems to give a smoother plot that is nicer to look at, compared to LASSO regularization.

CA anomalies: night vs day

As another example, let us look at the maximum daily temperatures (day) and minimum daily temperatures (night)

      year  month  value
0     1895      1   47.4
1     1895      2   56.1
2     1895      3   58.2
3     1895      4   65.6
4     1895      5   74.3
...    ...    ...    ...
1575  2026      4   68.4
1576  2026      5   77.4
1577  2026      6   86.7
1578  2026      7   92.1
1579  2026      8   93.6

[1580 rows x 3 columns]
      year  month  value
0     1895      1   33.6
1     1895      2   36.0
2     1895      3   37.4
3     1895      4   41.8
4     1895      5   48.3
...    ...    ...    ...
1575  2026      4   43.8
1576  2026      5   50.6
1577  2026      6   58.0
1578  2026      7   63.1
1579  2026      8   64.5

[1580 rows x 3 columns]
<Figure size 1000x800 with 2 Axes>
<Figure size 1000x500 with 1 Axes>

It is difficult to understand differences between the two time series from this plot. We can again fit the model (via ridge or lasso regularization), and then plot the estimated trend functions.

[[ 1.000e+00  0.000e+00 -0.000e+00 ... -0.000e+00 -0.000e+00 -0.000e+00]
 [ 1.000e+00  1.000e+00  0.000e+00 ... -0.000e+00 -0.000e+00 -0.000e+00]
 [ 1.000e+00  2.000e+00  1.000e+00 ... -0.000e+00 -0.000e+00 -0.000e+00]
 ...
 [ 1.000e+00  1.577e+03  1.576e+03 ...  1.000e+00  0.000e+00 -0.000e+00]
 [ 1.000e+00  1.578e+03  1.577e+03 ...  2.000e+00  1.000e+00  0.000e+00]
 [ 1.000e+00  1.579e+03  1.578e+03 ...  3.000e+00  2.000e+00  1.000e+00]]
100000000.0
1000000000.0
<Figure size 1000x500 with 1 Axes>

So nights started warming earlier than days, but now days have warmed up more.

1000.0
10000.0
<Figure size 1000x500 with 1 Axes>
<Figure size 1000x500 with 1 Axes>