I would like to model repeated measures data with R and the library splines.

However, I am kind of confused about the difference between the bs () and ns () functions. (I am sorry if this might be a stupid question, but I just cannot figure it out by reading the documentation or online examples). I have constructed models with both functions and the predictions from ggpredict look quite the same. However, the parameters in the outputs are not exactly identical.

Here are my models:

    bs_model = lmer(outcome ~ bs(time, degree=1,knots =1) * group + age_sc + sex + (time|subject), data)

    ns_model = lmer(outcome ~ ns(time, knots =1) * group + age_sc + sex + (time|subject), data)

Can someone tell me what the difference is, between these two models?

  • $\begingroup$ You might want to narrow down your question to focus on the difference between b-splines (bs()) and natural cubic splines (ns()). This question really isn't about mixed models. Some questions related to this have already been asked on the site, but I think there's room for a canonical answer to what is probably an often-thought question. $\endgroup$ – Noah Apr 27 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.