1
$\begingroup$

I am wondering why you would want to use a by variable smooth s(time, by= x)? (time is non-linear hence why I am using GAMs)

I am using GAMs to explore if my response $y$ changes over $x$ or some other categorical factor. Furthermore, if $y$ changes over on $x$, have these differences changed over time?

Also, if I have an interaction between $x$ and $z$, what would be the reasons for me including this interaction in the by = argument over time as s(time, by= interaction(x,z))?

How do you assess if you need to have different smooths/curves for an interaction?

Any help is appreciated, I am new to GAMs!

$\endgroup$
4
  • $\begingroup$ Welcome to CV elaine! $\endgroup$ – Alexis Mar 5 at 18:00
  • $\begingroup$ s(time, by= x) is a very general form of interaction. Say you are modeling the development of some (measurement) for a disease with time, and you have reason to believe this time development is different for men and women. Otherwise, maybe ask for your real applied problem! $\endgroup$ – kjetil b halvorsen Mar 5 at 19:31
  • $\begingroup$ Hi kjetil! Thanks for your answer. So if I see an interaction between Gender and some other categorical variable ie ethnicity. Would I then fit the smooth s(Year, by= interaction(Gender, ethnicity)) if I had reason to believe that this interaction changed over time? Thanks! $\endgroup$ – elaine Mar 6 at 13:39
  • $\begingroup$ @elaine: At least that might be a starting point. Maybe ask your real, applied proble with more contextual information. $\endgroup$ – kjetil b halvorsen Mar 7 at 2:06

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.