0
$\begingroup$

Two questions: 1. Concurvity for factors =1, is this normal? 2. How do you interpret a partial effect when the effect is linear and lines for confidence intervals are pinched at 0?

  1. Is it okay for covariates in gam models that are entered as factors (and random effects), to result in a concurvity value of =1? One factor has 2 levels (absence or presence of boulders) and the other has 6 levels (6 years). These two covariates are entered as main effects and as mixed effects and the concurvity value for these two =1. Both factors appear to have a positive linear effect overall. Am I missing something blatantly obvious where collinearity for these factors/categorical values can be ignored?

See how covariates in bold appear in the model: =Gam(species + s(covariate1, bs="cr") +s(covariate2, bs="cr") +s(factor1,bs="re") + +s(factor2,bs="re") +s(covariate2, factor2, bs=c("cr","re"))

  1. How do you interpret a partial effect that is linear and SE lines are pinched at 0? One could interpret this as a positive or negative linear relationship, what else are takeaways? In my model, convergence is reached via gam.check() and K values appear fine via gam.check(). Could this be because data is sparse? Data is not patchy? Too many zeroes? It looks like wiggles can be turned on or off, smoothed over or amplified, as K is increased or decreased. This also seems to vary if a high or low K is assigned to the main or mixed effect, or both. For reporting and a tabulated comparison of models, it makes sense to go with the lower AIC, but for visual interpretation and to distill any patchiness in the data, how far does one go to change K? How does one not overfit or under-fit? In some instances K knots are negligible, but if it can induce more wiggles, how to gauge this? A general approach I take is setting K as high as I can, then reducing K as needed. Should K value be the same for a variable when it is entered as a main effect and also as a mixed effect?

Need some reassurance as I observed:

*When K=-1, this did not catch the wiggle in the data, not until manually changed.

*Wiggles observed when K for main effect is high, while K for same variable as a mixed effect is low.

*Wiggles not observed when K for main effect is high, and K for same variable as mixed effect is high

Part 2

Q1: I mean to write “ti” where: …+ ti(covariate2, factor2, bs=c("cr","re"))

Q2: I may have misstated and yes, a mixed effects model (see below). What is the rule of thumb for modifying the K value of a covariate when both a fixed and random effect? I can edit K for the fixed effect but not sure what guidance to use to edit K for the random effect. See covariate 5 and 6 below.

                 =gam(species~ 
                 s(covariate1), bs="cr",k=10)+
                 s(covariate2), bs="cr",k=10)+
                 s(covariate3), bs="cr",k=10)+
                 s(covariate4, bs="re",k=10)+
                 
                 
                 s(covariate5, bs="re",k=10)+
                 s(covariate6, bs="cr",k=50)+
                 ti(covariate6, covariate5, bs=c("cr","re"),k=c(20,10), m=1),
               
               data=data,
               family=nb(link = "log"),
               method="ML", optimizer=c("outer","bfgs"))#, select=TRUE); may add this
$\endgroup$

1 Answer 1

1
$\begingroup$

Q1: with factors that have a smallish number of levels, I believe that there will inevitably be concurvity in the parametric part of the model. I don't think this is a problem however.

Assuming the code you showed isn't pseudocode, you can't write s(covariate1, factor1, bs = c("cr", "re")) as s() doesn't allow for smooth interactions of this sort where you have separate marginal bases.

Q2: the uncertainty band given the usual definitions has to go to 0 at the point where the linear function crosses the y = 0 point as that point. That linear functions do this is well known and leads to lower coverage than is implied by the $1 - \alpha$ coverage requested. A correction has been proposed by Marra and Wood, and which is implemented in {mgcv}, which in essence applies the uncertainty in the constant term (the intercept; or overall mean) to the estimated smooths, in turn. This has the effect of creating intervals with the correct nominal coverage, but in doing so fixes the "bow-tie" interval problem associated with smooth functions that are estimated to be linear.

k = -1 just means "use the entirely arbitrary default for this type of smooth". It is set to -1 because for s() you want the number of basis functions used by default to scale with the dimension of the smooth. I believe the default for 2d or grater thin plate splines is 5^d, hence 25 for a 2d thin plate spline, etc.

I'm not sure I follow what you mean by a "mixed effect"? You might have a model that contains both random and fixed effects, in which case some might call the model a "mixed effects model" but I'm struggling to think of situations where a single covariate would enter a model as a "mixed effect".

$\endgroup$
1
  • $\begingroup$ Thank you, Gavin. For Q1 I meant to write "ti" --see Part 2 above. For Q2 under what instances should the K value of a covariate remain the same when entered as both a fixed and random effect (see Part 2, covariate 5 and 6)? I am now wondering how K is best modified or not when using model selection via select=TRUE. $\endgroup$
    – frog_dan
    Commented Mar 7, 2022 at 18:43

Your Answer

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

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