getViz {mgcViz} | R Documentation |
Converting gam objects to gamViz objects
Description
This function converts gam
objects into gamViz
objects,
for which mgcViz
provides several plotting methods.
Usage
getViz(o, nsim = 0, post = FALSE, newdata, ...)
Arguments
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 |
Value
An object of class gamViz
.
Examples
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()