[R] mgcv with discrete covariates, interaction term

John Tillinghast tilling at gmail.com
Mon Dec 21 19:20:21 CET 2009


I'm trying to build a model with an overall smooth function for all  
the data, plus an additional smooth function for *some* of the data.
If "ind" is my indicator variable (0 for some x, 1 for others), I  
imagined I could write it like this:

gam.obj <- gam(y ~ s(x) + ind*s(x))

but this does not work.

Does mgcv have a way of doing this? If not directly, is there a  
reasonable workaround?




More information about the R-help mailing list