Learn R Programming

hnp (version 1.0)

plot.hnp: Plot Method for hnp Objects

Description

The plot method for objects of class hnp.

Usage

## S3 method for class 'hnp':
plot(x, cex, pch, col, lty, lwd, type,
                          xlab, ylab, main, legpos, legcex, ...)

Arguments

x
object of class "hnp".
cex
character expansion size.
pch
character string or vector of one character or integer for plotting characters, see points.
col
vector of colors.
lty
vector of line types.
lwd
vector of line widths.
type
type of plot for each envelope band and points. Default is c("l","l","l","p").
xlab
title for x axis, as in plot
ylab
title for y axis, as in plot
main
plot title.
legpos
if print.on=TRUE, represents the position where the information should be printed ("topright", "topleft", "bottomright", "bottomleft"), as in legend<
legcex
if print.on=TRUE, character expansion size of legend.
...
extra graphical arguments passed to matplot.

Value

  • None.

encoding

UTF-8

References

Demétrio{Demetrio}, C. G. B. and Hinde, J. (1997) Half-normal plots and overdispersion. GLIM Newsletter 27:19-26. Hinde, J. and Demétrio{Demetrio}, C. G. B. (1998) Overdispersion: models and estimation. Computational Statistics and Data Analysis 27:151-170. Demétrio{Demetrio}, C. G. B., Hinde, J. and Moral, R. A. (2014) Models for overdispersed data in entomology. In Godoy, W. A. C. and Ferreira, C. P. (Eds.) Ecological modelling applied to entomology. Springer.

See Also

hnp

Examples

Run this code
## Simple Poisson regression
set.seed(100)
counts <- c(rpois(5, 2), rpois(5, 4), rpois(5, 6), rpois(5, 8))
treatment <- gl(4, 5)
fit <- glm(counts ~ treatment, family=poisson)
anova(fit, test="Chisq")

## half-normal plot
hnp(fit)

## or save it in an object and then use the plot method
my.hnp <- hnp(fit, print.on=TRUE, plot=FALSE)
plot(my.hnp)

## changing graphical parameters
plot(my.hnp, lty=2, pch=4, cex=1.2)
plot(my.hnp, lty=c(2,3,2), pch=4, cex=1.2, col=c(2,2,2,1))
plot(my.hnp, main="Half-normal plot", xlab="Half-normal scores",
     ylab="Deviance residuals", legpos="bottomright")

Run the code above in your browser using DataLab