0

I am doing HGAM with the brm function (brms package). For now, I kept the default k = 10, but I want to know if I should set k higher. I know that the function k.check in the mgcv package does that diagnostic, but I can't find any equivalent for brms.

Does an equivalent of mgcv::k.check exist for brms? If not how can I know if my k is sufficient? I could change it and check the fit, but I am limited in time and computer power.

Thank you!

  • I don't believe this exists per this thread: https://discourse.mc-stan.org/t/knots-and-basis-dimension-in-brms/12016 – sjp Jan 14 '22 at 07:47
  • 1
    You could take samples of the residuals and pass them into a locally hacked version of `k.check()` to run the test over many samples, to get the posterior of the test stat and then summarise that posterior. By "locally hacked" I mean strip out the guts of `k.check` into your own function that can take the required inputs plus samples of the residuals. – Gavin Simpson Jan 14 '22 at 12:34
  • Perfect thank you! I will try that. By the way @GavinSimpson I based all my GAMs on paper you authored or co-authored and conferences you gave. Thanks for your super usefull work (I am a fan!). – Julien Beaulieu Jan 14 '22 at 14:43

0 Answers0