[R] mgcv : 3-way interaction and 3D-plots ?
varin sacha
v@rin@@ch@ @ending from y@hoo@fr
Tue Jan 8 00:35:42 CET 2019
Dear R-experts,
I have fitted a model with 2-way and 3-way interactions.
I would like, for the 3-way interaction (year,age,by=education), to obtain 3D-plots. How could I do that ?
Many thanks for your response.
Here is the reproducible example:
#############
install.packages("ISLR")
library(ISLR)
install.packages("mgcv")
library(mgcv)
mod1<-gam(wage ~education+s(age,bs="ps")+year+te(age,year,bs="ps")+s(year,bs="ps",by=education,m=1)+te(year,age,by=education,bs=rep("ps",2)),data=Wage)
plot(mod1)
#############
More information about the R-help
mailing list