| plot.cozigam {COZIGAM} | R Documentation |
Takes a fitted cozigam object produced by cozigam() and plots
the component smooth functions that make it up, on the scale of the linear predictor.
## S3 method for class 'cozigam':
plot(x, plot.2d = "contour", too.far = 0.05,
n.1d = 100, n.2d = 30, theta = 30, phi = 30, select = NULL, image.col = "topo",
persp.col = "lightblue", contour.col = "red", n.Col = 100, shade.ci = FALSE,
shade.col = "gray80", Rug = TRUE, ...)
x |
a fitted cozigam object produced by cozigam(). |
plot.2d |
one of "contour" (default) or "persp". |
select |
allows the plot for a single model term to be selected for printing.
e.g. if you just want the plot for the second smooth term set select=2. |
n.1d |
number of points used for each 1-D plot. Default value 100. |
n.2d |
square root of number of points used to grid estimates of 2-D functions for contouring. |
theta |
one of the perspective plot angles. |
phi |
the other perspective plot angle. |
too.far |
if greater than 0 then this is used to determine when a location
is too far from data to be plotted when plotting 2-D smooths. This is useful
since smooths tend to go wild away from data. The data are scaled into the unit
square before deciding what to exclude, and too.far is a distance within
the unit square. |
shade.ci |
logical. If TRUE, produce shaded regions as confidence bands for smooths. |
shade.col |
define the color used for shading confidence bands. |
image.col |
define the color used for 2-D image plots. |
persp.col |
define the color used for 2-D perspective plots. |
contour.col |
define the color used for the 2-D contour lines. |
n.Col |
control the number of colors in 2-D image plots. |
Rug |
logical, if TRUE (default) then the covariate to which the
plot applies is displayed as a rug plot at the foot of each plot of a 1-D smooth,
and the locations of the covariates are plotted as points on the contour plot
representing a 2-D smooth. |
... |
other graphics parameters to pass on to plotting commands. |
Produces default plot showing the smooth components of a fitted cozigam.
Smooths of more than 2 variables are not currently dealt with, but simply generate a warning.
The function simply generates plots.
Hai Liu and Kung-Sik Chan
set.seed(11)
n <- 600
x1 <- runif(n, 0, 1)
x2 <- runif(n, 0, 1)
x3 <- runif(n, 0, 1)
f <- test(x1, x2)*4-mean(test(x1, x2)*4) + f0(x3)/2-mean(f0(x3)/2)
sig <- 0.5
mu0 <- f + 3
y <- mu0 + rnorm(n, 0, sig)
alpha0 <- -2.2
delta0 <- 1.2
p0 <- .Call("logit_linkinv", alpha0 + delta0 * mu0, PACKAGE = "stats")
z <- rbinom(rep(1,n), 1, p0)
y[z==0] <- 0
res <- cozigam(y~s(x1,x2)+s(x3), conv.crit.out = 1e-4, family = gaussian)
plot(res, plot.2d = "contour", too.far = 0.1, image.col="topo")
plot(res, plot.2d = "persp", too.far = 0.1, select=1)