Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using derivatives with random smooths by individual #243

Open
gavinsimpson opened this issue Dec 7, 2023 Discussed in #242 · 0 comments
Open

Using derivatives with random smooths by individual #243

gavinsimpson opened this issue Dec 7, 2023 Discussed in #242 · 0 comments

Comments

@gavinsimpson
Copy link
Owner

Discussed in #242

Originally posted by TSeuH December 6, 2023
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant