Question for factor levels in gam #172
Replies: 1 comment
-
Q1Models iii and iv are wrong - you can't smooth a factor and with the odd exception (the Models i and ii could work but you must include
which one you want depends on several things. The first would model two entirely separate smooths, one per level of Q2No, I don't think this is right. You have a potential (or known) interaction between the effect of Q3If you fitted the model as any of these
then no, you can't exclude What I would do instead would be to generate predictions under the two scenarios of You could perhaps treat |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Dear Gavin,
I used gam to simulate and then predict
YbyX,Z, andXtvariables, but I am not sure about how to use these variables ingam. I appreciate it if you could help me about it.XandZare numbers and I assume there is an interaction between them.Xtis treatment as factor (with 2 levels, 1 = low and 2 = high).Xthas a direct effect onXvariable. The increase in Xt should decreases the X value.I used the
gamfunction as follow:If I want to find the effects of treatment Xt on X and then Y variable which form of these smooth functions are correct?
s(X, by = Xt)s(X) + s(X, by = Xt)s(X , Xt, bs = 'tp' )s(X , Xt, bs = c( 'tp', ‘re’) )Is it right if I just use
s(X)to measure the effects ofXtandXonY? because the effect ofXttreatment onYis already reflected on X variable.Can I use the predict function by excluding
s(X, by = Xt)for a new dataset withoutXtvariable? (the new dataset contains dummy data of all variables exceptXt)Thank you
Nat
Beta Was this translation helpful? Give feedback.
All reactions