Replies: 4 comments 2 replies
-
I will take a closer look later, but initial thoughts are that you need |
Beta Was this translation helpful? Give feedback.
-
I'll also add that I doubt the derivative will be that informative if you set |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer! fdSmooth <- derivatives(gam.smooth, n = 1000, term = "s(time, animalID)", partial_match = TRUE) |
Beta Was this translation helpful? Give feedback.
-
I have just noticed that if I remove the space between time and animalID, I get a different error message: derivatives(gam.smooth, n = 1000, term = "s(time,animalID)", partial_match = TRUE) |
Beta Was this translation helpful? Give feedback.
-
Hello,
I have been trying to get the first derivatives for each individual fit from the following model:
gam.smooth <- gam(TV ~ groupID +
s(time, by = groupID) +
s(time, animalID, bs = "fs", m = 1),
data = dataTV, method = "REML")
fdSmooth <- derivatives(gam.smooth, n = 1000, term = "s(time)", partial_match = TRUE)
I see a column "fs_var" in fdSmooth, and I was assuming it would contain "animalID", just like by_var contains "groupID". I thought I could get the first derivative for each animalID, but with this code, I only get the first derivative for each groupID, regardless of the animalID.
Would it be possible to have the derivatives by animalID without changing the GAM?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions