I'm working on a dataset monitoring soil moisture levels throughout the summer. The general trend in the data is the following:

enter image description here

When I use a GAM with default thin-plate spline and AR(1)process there is still a clear residual pattern: enter image description here

Now if instead I use a cyclic spline the residual pattern improves, but observed vs. fitted values get's a bit worse, this model also has a higher AIC value: enter image description here

My Question is whether it is appropriate to go for the cyclic spline here as it improves the residual structure, even though overall model fit is worse.

  • $\begingroup$ Can you please tell us in what sense the residual structure has improved? And why do you expect the moisture level during summer to be periodic? $\endgroup$ – kjetil b halvorsen Dec 16 '18 at 10:25
  • $\begingroup$ In the residuals vs linear predictor subplot of the first example (top-right), the deviance is much wider for lower predictor values then higher ones. In the second example this is more spread. Yes, this is exactly the reason why I was not sure whether cyclic spline is appropriate, because soil moisture is not generally periodic but decreases during the summer and increases a bit again at the end as the rains come back in, but only to about half of the level it was before the beginning of the summer. $\endgroup$ – Mark Dec 16 '18 at 11:16
  • $\begingroup$ Well, the fit is nowhere better, it is just more homoskedastic. That seems to be a bad reason to introduce a modeling assumption (periodicity) that you know is untrue! If heteroskedasticity is a problem, there will be better ways to handle that. Maybe just use robust standard errors. Especially, looking at your first plot, it is manifest that the variance is lower at the high (early summer) end, and to see that reflected in the fit cannot be bad. $\endgroup$ – kjetil b halvorsen Dec 16 '18 at 12:05
  • $\begingroup$ Oke thanks very much I didn't know about robust SE's yet! $\endgroup$ – Mark Dec 16 '18 at 12:07
  • $\begingroup$ Can you please provide some context about your modelling task? For example, what is the periodic spline about? Is it weekly? Monthly? Across all the available data? Also, is AR(1) adequate? Have you plot the residuals ACF/PACF with and without the inclusion of the AR(1) term? Why AR(1) and not MA(1) for example? And finally what it the final goal? Predicting new values? Testing some hypothesis? Visualisation of trends? $\endgroup$ – usεr11852 Dec 16 '18 at 14:02

The fast answer is NO, you should not use periodic splines. In a way you are trying to fix a secondary problem (heteroskedasticity) by unfixing the primary problem, to get the predictions right.

Some more details: Your first plot shows lower variance in the early summer part of the plot, higher variance for later summer. In this case, that is lower variance goes with generally higher values. Transformations are mostly used for the opposite pattern, so are probably not of much use here. In addition, they will complicate the modeling, so stay away from transformations.

Your second&third plot (model with smoothing splines) is what you would expect in this case: more variability among residuals when the variance in the data is higher. That is just a part of the phenomenon to be modelled, not really a problem. The heteroskedasticity is not strong enough to warrant much, one could use weighted estimation, but you would estimate the weights from the data, probably not gaining much, and introducing further problems (how do you get correct standard errors when the weights are estimated? You could try bootstrapping, my guess is that you would not gain anything ...)

The last plots (model with periodic smoothing splines) confirms this: Yes, now the residuals have about constant variance, but it is everywhere higher! So you have gained nothing. Maybe try robust standard errors. If you are using R there is some useful hints and code here: How to calculate the robust standard error of predicted y from a linear regression model in R? (which is closed for unfathomable reasons, it seems understandable and useful)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.