Solved – Gam with low E.D.F (estimated degrees of freedom) value in main effect, not interaction term

generalized-additive-modelmgcvsemiparametric

I have a gam model with the following structure:

gam(sv ~ s(day, bs="ts") + s(range, bs="ts") + s(time, bs="cc") + 
      ti(day, range, bs=c("ts", "ts")), data=train.all, method="REML")

In this model's summary range has an e.d.f of 0.95, and day,range has an e.d.f of 2.8

I have seen before that if a model term has an e.d.f close to 1 that you should change it to be a normal parametric term. I have two questions:

  1. In this case, when the main effect appears parametric, do I also modify the interaction term between day and range to have range as parametric, or can you have a main effect that is parametric and in an interaction term it is a smooth?

  2. I am using "ts" basis, so sometimes I receive values below 1 e.d.f that are more like 0.85 e.d.f. Does this still indicate a parametric term? I am a little confused how the value is slightly below 1, but not really close to 0.

Thank-you very much,
Hannah

Best Answer

Q1

No, leave it in as an s() term; part of the wiggliness in range is taken up in the ti(day, range) term. In fact it would seem sensible to decide whether ti(day, range) is needed and if it is, refit the model with te(day, range) rather than the separate s() terms plus the ti() term, if only for the reduction in the number of smoothing parameters that need to be estimated (from 8 with your model to 4 for the te() version - which are doubled from the 4 or 2 parameters I think because of the shrinkage thin-plate splines you are using).

Q2

Values like this are common when you turn on shrinkage (either via shrinkage splines or via the double-penalty approach using select = TRUE. Both options allow shrinkage of the null space of the penalty matrix. This null space include the set of basis functions that are completely smooth. Without the shrinkage, the smoothness parameters would shrink the wiggly parts of the model until all that was left was the linear function. In that case the range space is shrunk by the smoothness parameter but not the null space.

By adding an extra penalty, in your case by adding a small value to the zero eigenvalues of the penalty matrix, the null space can now also be shrunk via a second penalty and associated smoothness parameter. This allows for the linear part of the spline to be shrunk a little (or a lot) towards the model intercept. If you're familiar with the LASSO penalty you will notice a similarity; the shrunken linear function doesn't have it's full least-squares estimated effect but a somewhat smaller effect because of the shrinkage towards zero. The penalty is different in splines but the effect is similar. The less-than-1 EDF for the term just reflects this.

You can often find spline terms with EDF <1 that are not linear. In that case it seems that the null space (the linear, perfectly smooth bits) has been shrunk as well as the range space (the wiggly bits) but the smoothness parameter(s) for the wiggly bit allow some small amount of wiggliness and the shrinkage to the null space drags the EDF below 1. This is fine; the model is estimating a slightly wiggly function but uncertainty in that estimate probably means that a linear function will reside in the 95% confidence interval for the smooth.

Related Question