2
$\begingroup$

I have fitted a model in glmmTMB that includes an spline function for age using the bs function from the splines package (version 3.6.2) in R. The syntax in glmmTMB looks like this: glmmTMB(litter_size ~ bs(maternal_age, 3) + prey_abundance + (1|motherID), data = ourdata, family=poisson)

One of my colleagues suggested that I should provide the effective degrees of freedom (EDF) for the spline term when reporting the results. Is there a method to get the EDF for this term from the glmmTMB model object?

I know I can get the EDF by using the mgcv package but in this case, I prefer to use glmmTMB if possible.

$\endgroup$

1 Answer 1

4
$\begingroup$

The spline you included in the model isn't penalised so its EDF is 3 because that's what you set it to.

To confirm, run with(ourdata, ncol(bs(maternal_age, 3))) and check the number of columns.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks a lot! I think I'll switch to the mgcv package for the modelling to get penalized splines. The example you have made on random effects in mgcv has been really helpful in this respect. $\endgroup$ Sep 12, 2022 at 19:24

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.