I have used a generalized additive model to analyse some data and now wish to plot the outcome.
library(mgcv)
set.seed(2) ## simulate some data...
dat <- gamSim(1,n=400,dist="normal",scale=2)
b <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat)
plot(b,pages=1)
From the example above, how is it possible to save the individual plots into different pdf files?
?plot.gam tells you that there is a select argument
library(mgcv)
set.seed(2) ## simulate some data...
dat <- gamSim(1,n=400,dist="normal",scale=2)
b <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat)
plot(b,pages=1)
plot(b, select = 1)
plot(b, select = 2)