[S] GAM interactions resulting in separate curves when there are other terms

Charles Anderson (charles.anderson@dnr.state.mn.us)
Wed, 02 Sep 1998 11:31:36 -0500


What is the correct way to fit a GAM with an interaction between a categorical predictor and a continuous one when there are other terms in the additive model? This is the same problem outlined in the last paragraph of Hastie and Tibshirani (1994) page 265.

I've tried:

gam(y~s(w) +(treat==0)*s(sbp0) +(treat==1)*s(sbp1), family=...

where treat is a numerical variable coded 0 for untreated and 1 for treated, sbp0 and sbp1 are two identical vectors for sbp, and s(w) is another term.

Is this the right way to set up the variables, and the right syntax? If not, what is?

Thanks.
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news