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.
-
Dear Gavin,
I used gam to simulate and then predict
Y
byX
,Z
, andXt
variables, but I am not sure about how to use these variables ingam
. I appreciate it if you could help me about it.X
andZ
are numbers and I assume there is an interaction between them.Xt
is treatment as factor (with 2 levels, 1 = low and 2 = high).Xt
has a direct effect onX
variable. The increase in Xt should decreases the X value.I used the
gam
function 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 ofXt
andX
onY
? because the effect ofXt
treatment onY
is already reflected on X variable.Can I use the predict function by excluding
s(X, by = Xt)
for a new dataset withoutXt
variable? (the new dataset contains dummy data of all variables exceptXt
)Thank you
Nat
Beta Was this translation helpful? Give feedback.
All reactions