Extracting data used to make a smooth plot in mgcv
问题 This thread from a couple of years ago describes how to extract data used to plot the smooth components of a fitted gam model. It works, but only when there is one smooth variable. I've got more than one smooth variable, and unfortunately I can only extract the smooths from the last of the series. Here is an example: library(mgcv) a = rnorm(100) b = runif(100) y = a*b/(a+b) mod = gam(y~s(a)+s(b)) summary(mod) plotData <- list() trace(mgcv:::plot.gam, at=list(c(25,3,3,3)), #this gets you to