Baseline Model

From the first look at the correlations, a model with polynomials looked fitting. So let’s here fit such a model, that would be the model to beat later down the line.

Polynomial Model

Here we stick to a simple OLS, but using a polynomial specification for the predictors temperature and air humidity, thereby, addressing one of the TODOs listed after the naive model

⏩ stepit 'baseline': Starting execution of `strom.modelling.assess_model()` 2025-11-24 03:25:02

⏩ stepit 'get_single_split_metrics': Starting execution of `strom.modelling.get_single_split_metrics()` 2025-11-24 03:25:02

✅ stepit 'get_single_split_metrics': Successfully completed and cached [exec time 0.0 seconds, cache time 0.0 seconds, size 1.0 KB] `strom.modelling.get_single_split_metrics()` 2025-11-24 03:25:02

♻️  stepit 'cross_validate_pipe': is up-to-date. Using cached result for `strom.modelling.cross_validate_pipe()` 2025-11-24 03:25:02

✅ stepit 'baseline': Successfully completed and cached [exec time 0.1 seconds, cache time 0.0 seconds, size 14.9 KB] `strom.modelling.assess_model()` 2025-11-24 03:25:02

Metrics

Single Split CV
train test test train
MAE - Mean Absolute Error 2.081715 2.370468 1.434274 2.296291
MSE - Mean Squared Error 12.363331 21.082804 3.517579 14.436913
RMSE - Root Mean Squared Error 3.516153 4.591601 1.776864 3.797367
R2 - Coefficient of Determination 0.867354 0.776769 0.296869 0.854141
MAPE - Mean Absolute Percentage Error 0.200527 0.220512 0.220100 0.204433
EVS - Explained Variance Score 0.867354 0.785383 0.490437 0.854141
MeAE - Median Absolute Error 1.314816 1.374856 1.250695 1.483029
D2 - D2 Absolute Error Score 0.699475 0.666753 0.150291 0.676570
Pinball - Mean Pinball Loss 1.040858 1.185234 0.717137 1.148145

Scatter plot matrix

Observed vs. Predicted and Residuals vs. Predicted

Check for …

check the residuals to assess the goodness of fit.

  • white noise or is there a pattern?
  • heteroscedasticity?
  • non-linearity?

Normality of Residuals:

Check for …

  • Are residuals normally distributed?

Leverage

Scale-Location plot

Residuals Autocorrelation Plot

Residuals vs Time

TODOs

Substantial improvement here, we still have some items in the to-do list and given these results, I would add a coulpe more:

Polynomials but using statsmodels …

                            OLS Regression Results                            
==============================================================================
Dep. Variable:                     wd   R-squared:                       0.851
Model:                            OLS   Adj. R-squared:                  0.850
Method:                 Least Squares   F-statistic:                     650.5
Date:                Mon, 24 Nov 2025   Prob (F-statistic):               0.00
Time:                        03:25:06   Log-Likelihood:                -3447.1
No. Observations:                1261   AIC:                             6918.
Df Residuals:                    1249   BIC:                             6980.
Df Model:                          11                                         
Covariance Type:            nonrobust                                         
=======================================================================================
                          coef    std err          t      P>|t|      [0.025      0.975]
---------------------------------------------------------------------------------------
Intercept              26.2162      2.714      9.658      0.000      20.891      31.542
tt_tu_mean             -1.9158      0.093    -20.707      0.000      -2.097      -1.734
I(tt_tu_mean ** 2)      0.1323      0.009     14.530      0.000       0.114       0.150
I(tt_tu_mean ** 3)     -0.0091      0.002     -6.039      0.000      -0.012      -0.006
I(tt_tu_mean ** 4)      0.0004      0.000      3.624      0.000       0.000       0.001
I(tt_tu_mean ** 5)  -7.126e-06   2.63e-06     -2.705      0.007   -1.23e-05   -1.96e-06
rf_tu_mean              0.0365      0.034      1.088      0.277      -0.029       0.102
rf_tu_min              -0.0130      0.018     -0.743      0.458      -0.047       0.021
rf_tu_max              -0.0466      0.040     -1.169      0.242      -0.125       0.032
tt_tu_mean.shift(1)    -0.2578      0.075     -3.457      0.001      -0.404      -0.112
tt_tu_mean.shift(2)     0.0374      0.073      0.512      0.609      -0.106       0.181
tt_tu_mean.shift(3)    -0.1064      0.050     -2.142      0.032      -0.204      -0.009
==============================================================================
Omnibus:                     1307.834   Durbin-Watson:                   0.897
Prob(Omnibus):                  0.000   Jarque-Bera (JB):           126205.286
Skew:                           4.769   Prob(JB):                         0.00
Kurtosis:                      51.073   Cond. No.                     4.85e+07
==============================================================================

Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
[2] The condition number is large, 4.85e+07. This might indicate that there are
strong multicollinearity or other numerical problems.
Model Cards provide a framework for transparent, responsible reporting. 
 Use the vetiver `.qmd` Quarto template as a place to start, 
 with vetiver.model_card()
Writing pin:
Name: 'waermestrom'
Version: 20251124T032506Z-4d883
<vetiver.vetiver_model.VetiverModel at 0x7f5b088477c0>

here’s also the polynomial model, but using scikit-learn

0.8460040216097842