[R-sig-ME] plotting gams in mgcv

john benson smilodon2000 at hotmail.com
Sun Jan 25 22:36:37 CET 2015


Hi,
I am running a GAM that has a smooth x factor interaction accomplished with the "by" function.
The model looks like this where X1 is a continuous smooth term and X2 is a categorical factor variable with 2 levels:
Gam1<-gam(y~s(X1, by = X2) + X2, data=datum)summary(Gam1)plot (Gam1)
The plot of this model gives separate figures for the separate smooth functions for each level (n=2) of the factor term.  I would like the rug plot for each figure to show only the locations of the covariate values along the x-axis that are specific to each level of the factor term.  
Instead, the gam plot gives me identical rug plots (with all covariate locations across both factor levels) for both of the 2 plots of the separate smooth functions.
Does anyone know if it is possible to only display the rug plot for covariate values associated with correct level of the factor variable for each of these 2 figures? 
Many thanks for any help with this!
Best,
John 		 	   		  
	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list