Closed Fred-Wu closed 2 years ago
Thanks for the question. There is no 'by' argument, but you can easily fit such kind of model using standard interaction terms and then manually extracting the parameters for prediction.
For instance, if you have a cross-basis object cb and a factor fac that takes values 'a' and 'b', you can:
You can find more complex examples of such an approach for specifying linear interactions here: http://www.ag-myresearch.com/2015_gasparrini_ehp.html http://www.ag-myresearch.com/2016_gasparrini_aje.html
I am conducting an study which is not only looking at an overall exposure-lag-response, but group level effect as well. Is there anyway to specify crossbasis for different groups, like “by” argument in the mgcv package?