I am trying to model CO2 fluxes (fco2) using a number of environmental parameters using a GAM in mgcv.

Specifically, I have leaf temperature (tl), vapour pressure deficit (vpd), and soil water content (swc). vpd is a function of tl, air pressure and relative humidity (both not measured). I getting the best model response when I have a 3-way interaction between them, but also a relatively good one with an interaction between tl and vpd. Now I'm wondering about the following:

  1. I am getting a lower AIC using s(), rather than te() in m1 or m2 below. Which one is correct and why is this?
m1 <- gam(fco2 ~ s(tl) + s(vpd) + s(swc) + ti(tl, vpd), data=df, method='REML')
m2 <- gam(fco2 ~ te(tl) + te(vpd) + te(swc) + ti(tl, vpd), data=df, method='REML')
  1. Since vpd is a function of tl (among other things), should one of the two variables be removed? This significantly increases AIC though and lowers R2.

Thanks a lot for the help


1 Answer 1

  1. The difference isn't really because you use s() or te(), but more because those two function generate smooth with different default bases. s() generates a low-rank thin plate spline basis, whereas te() uses a cubic regression spline basis for the marginal smooths.

    The correct way to express this model is using the s(x, bs = "cr") + s(z, bs = "cr") + ti(x,z) form. Although Simon allow's the ti() form (ti(x) + ti(z) + ti(x,z)) I find it a bit odd to create a tensor product interaction of a single variable. I know it works and gives effectively the same model as the s() form but I find the ti() version weird. The main plus in favour of the ti() form is that you are sure to get the right bases; with s() you need to specify the cr basis for example if you want to match the ti(), so it is something else that you need to think about and get right.

  2. If vpd is a function of tl, then it is likely that your model suffers from a problem called concurvity, which is where a term in the model can be represented by smooth combination of the other terms in the model. You can check this with the concurvity() function in {mgcv}. You don't have to remove tl; it sounds like it is not just a simple function of vpd so you might be OK leaving it in and accepting any high concvurvity (if present).

  • $\begingroup$ Great answer, thanks so much! $\endgroup$
    – J-M
    Jul 26 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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