I was wondering whether it was possible to specify an interaction by two variables term using ‘t2’ and also have those two variables as effects also. I remember in mgcv, if you wanted to do something similar you would use the ‘te’ term.
You may need to explain your question a little bit more. For instance, how would you specify such a model in mgcv?
So I am interested in questioning how the rate of grooming changes over time, and how this is influenced by the size of the individual at a certain time. This is how I set up the model
brm(GroomingRate ~ s(ActualAge.s) + s(WeightforAge.s)+ Sex+t2(ActualAge.s,WeightforAge.s,by=CohortbySex.f)+ (1+ActualAge.s+WeightforAge.s|JuveID)+(1|MotherID)
Apologies, and in mgcv, it would be simply replacing t2 with te.
I see. Looks reasonable to me. Is the brms specification causing any problems?
Yes, I seem to have trouble converging it. The data is plentiful , has a high iter start (2000), 4 chains and cores.
I remember having seen similar problems. Essentially, the s() and t2() splines try to predict the same relationship and thus we get convergence problems. Only estimating one or the other works well usually. Not sure if it would be better if brms supported te(). I don’t actually think so, but I might be mistaken. How does mgcv work when using t2() instead of te()?