Learn R Programming

VGAM (version 1.0-6)

plotvglm: Plots for VGLMs

Description

Currently this function plots the Pearson residuals versus the linear predictors (\(M\) plots) and plots the Pearson residuals versus the hat values (\(M\) plots).

Usage

plotvglm(x, which = "(All)", ...)

Arguments

x

An object of class "vglm" (see vglm-class) or inherits from that class.

which

If a subset of the plots is required, specify a subset of the numbers 1:(2*M). The default is to plot them all.

Arguments fed into the primitive plot functions.

Value

Returns the object invisibly.

Details

This function is under development. Currently it plots the Pearson residuals against the predicted values (on the transformed scale) and the hat values. There are \(2M\) plots in total, therefore users should call par to assign, e.g., the mfrow argument. Note: Section 3.7 of Yee (2015) describes the Pearson residuals and hat values for VGLMs.

See Also

plotvgam, plotvgam.control, vglm.

Examples

Run this code
# NOT RUN {
ndata <- data.frame(x2 = runif(nn <- 200))
ndata <- transform(ndata, y1 = rnbinom(nn, mu = exp(3+x2), size = exp(1)))
fit1 <- vglm(y1 ~ x2, negbinomial, data = ndata, trace = TRUE)
coef(fit1, matrix = TRUE)
par(mfrow = c(2, 2))
plot(fit1)

# Manually produce the four plots
plot(fit1, which = 1, col = "blue", las = 1, main = "main1")
abline(h = 0, lty = "dashed", col = "gray50")
plot(fit1, which = 2, col = "blue", las = 1, main = "main2")
abline(h = 0, lty = "dashed", col = "gray50")
plot(fit1, which = 3, col = "blue", las = 1, main = "main3")
plot(fit1, which = 4, col = "blue", las = 1, main = "main4")
# }

Run the code above in your browser using DataLab