physical constraint with gam
On 11/05/16 17:11, Dominik Schneider wrote:
Hi Simon, Thanks for this explanation. To make sure I understand, another way of explaining the y axis in my original example is that it is the contribution to snowdepth relative to the other variables (the example only had fsca, but my actual case has a couple others). i.e. a negative s(fsca) of -0.5 simply means snowdepth 0.5 units below the intercept+s(x_i), where s(x_i) could also be negative in the case where total snowdepth is less than the intercept value.
- Yes, this looks right.
The use of by=fsca is really useful for interpreting the marginal impact of the different variables. With my actual data, the term s(fsca):fsca is never negative, which is much more intuitive. Is it appropriate to compare magnitudes of e.g. s(x2):x2 / mean(x2) and s(x2):x2 / mean(x2) where mean(x_i) are the mean of the actual data?
- I guess so (similarly to lm/glm).
Lastly, how would these two differ: s(x1,by=x2); or s(x1,by=x1)*s(x2,by=x2) since interactions are surely present and i'm not sure if a linear combination is enough.
- you'd probably use te(x1,x2) unless x1 and x2 are really on the same scale, in which case s(x1,x2) might be appropriate. The `by' variable trick is probably not going to work so well for interactions, however (it's not so clear what the by variable should be).
Simon Wood, School of Mathematics, University of Bristol BS8 1TW UK +44 (0)117 33 18273 http://www.maths.bris.ac.uk/~sw15190 [[alternative HTML version deleted]]