Learn R Programming

gammSlice (version 2.0-2)

plot.gSlc: Plot smooth function components of gSlc() fits

Description

Smooth function components of generalized additive mixed model fits obtained via gSlc are plotted.

Usage

# S3 method for gSlc
plot(x,gridSize=401,colour = TRUE,responseScale = FALSE,
                    rug = TRUE,rugColour="dodgerblue",curveColour = "darkgreen",
                    varBandPolygon = TRUE,varBandColour = "palegreen",
                    xlab = NULL,ylab = NULL,bty = "l",cex.axis = 1,
                    cex.lab = 1,...)

Arguments

x

gSlc() fit object.

gridSize

Number of grid points used in graphical display of smooth function fits.

colour

Boolean flag: TRUE = produce colour plots FALSE = produce black and white plots.

responseScale

Boolean flag: TRUE = the smooth function fits are plotted on the response scale FALSE = the smooth function fits are plotted on the link scale (the default).

rug

Boolean flag: TRUE = add rug graphics to the base of each smooth function plot showing the predictor data (the default), FALSE = do not add rug graphs.

rugColour

colour of the rug graphics. The default value is "dodgerblue".

curveColour

colour of the curves in the smooth function display. The default value is "darkgreen".

varBandPolygon

Boolean flag: TRUE = display the variability band as a polygon (the default), FALSE = display the variability band using dashed curves.

varBandColour

colour of the variability band polygon in the smooth function display. The default value is "palegreen".

xlab

optional argument: character string vector for horizontal labels for smooth function plots.

ylab

optional argument: character string vector for vertical labels for smooth function plots.

bty

character string which specifies the type of box which is drawn about plots. See help(par) for details. The default value is "l".

cex.axis

positive number specifying the factor by which numbers along the axes are expanded.

cex.lab

positive number specifying the factor by which characters in the axis labels are expanded.

...

place-holder for other graphic parameters.

Details

For each smooth function component of the generalized additive mixed model specified in the call to gSlc the pointwise posterior mean is plotted along with a shaded polygon corresponding to pointwise 95% credible sets.

References

Pham, T. and Wand, M.P. (2018). Generalized additive mixed model analysis via gammSlice. Australian and New Zealand Journal of Statistics, 60, 279-300.

See Also

gSlc, summary.gSlc

Examples

Run this code
# NOT RUN {
library(gammSlice)
set.seed(53902)
n <- 400 ; x <- runif(n)
fTrue <- function(x) return(cos(4*pi*x) + 2*x - 1)
mu <- exp(fTrue(x)) ; y <- rpois(n,mu)
fit <- gSlc(y~s(x),family="poisson",control=gSlc.control(nBurn=200,nKept=200,nThin=1,msgCode=0))
plot(fit)
plot(fit,responseScale=TRUE,rug=FALSE)
points(x,y,col="dodgerblue")
# }

Run the code above in your browser using DataLab