getViz | R Documentation |
This function converts gam
objects into gamViz
objects,
for which mgcViz
provides several plotting methods.
getViz(o, nsim = 0, post = FALSE, newdata, ...)
o |
an object of class |
nsim |
the number of simulated vectors of responses. A positive integer. |
post |
if |
newdata |
Optional new data frame used to perform the simulations. To be passed to predict.gam and,
if |
... |
extra arguments to be passed to simulate.gam (if |
An object of class gamViz
.
library(mgcViz)
set.seed(2) ## simulate some data...
dat <- gamSim(1,n=1000,dist="normal",scale=2)
b <- gam(y~s(x0)+s(x1, x2)+s(x3), data=dat, method="REML")
b <- getViz(b, nsim = 20)
str(b$store$sim) # Simulated responses now stored here
plot(sm(b,1)) + l_fitLine() + l_ciLine() + l_rug() + l_points()
plot(sm(b,2)) + l_rug() + l_fitRaster() + l_fitContour()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.