plotvglm: Plots for VGLMs

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/plot.vglm.R

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

1
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.

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.

Value

Returns the object invisibly.

Author(s)

T. W. Yee

See Also

plotvgam, plotvgam.control, vglm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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")

## End(Not run)

Example output

Loading required package: stats4
Loading required package: splines
VGLM    linear loop  1 :  loglikelihood = -866.98211
VGLM    linear loop  2 :  loglikelihood = -864.35569
VGLM    linear loop  3 :  loglikelihood = -864.31882
VGLM    linear loop  4 :  loglikelihood = -864.31881
VGLM    linear loop  5 :  loglikelihood = -864.31881
            loglink(mu) loglink(size)
(Intercept)   3.0621270      1.128185
x2            0.9271081      0.000000

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.