Is it possible to plot the smooth components of a gam fit with ggplot2?
I am fitting a model using gam from the mgcv package and store the result in model and so far I have been looking at the smooth components using plot(model) . I have recently started using ggplot2 and like its output. So I am wondering, is it possible to plot these graphs using ggplot2? Here is an example: x1 = rnorm(1000) x2 = rnorm(1000) n = rpois(1000, exp(x1) + x2^2) model = gam(n ~ s(x1, k=10) + s(x2, k=20), family="poisson") plot(model, rug=FALSE, select=1) plot(model, rug=FALSE, select=2) And I am interest in s(x1, k=10) and s(x2, k=20) not in the fit. Partial answer: I dug deeper into