Dear R help list, I'm fitting a 'variable coefficient model' in the MGCV package and I want to plot the different smoothers I get for each factor level in one graph.
So, I do something like this to fit the gam: Mtest <- gam(outcome ~ s(age, by=as.numeric(gender==0)) + s(age,by=as.numeric(gender==1))+factor(Gender)) Then I can plot the smoother for gender=0: plot(Mtest,select=1) And for gender=1: plot(Mtest,select=2) But the second plot superimposes the first one. Normally I use 'lines' to plot just the line from the second plot in the first plot, but this doesn't seem to work with the plot.gam function. Does someone have a solution to plot these two smoothers in one graph, each with a different color/line type? Thanks in advance, Jef Vlegels ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.