plot.hnp: Plot Method for hnp Objects

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

Description

The plot method for objects of class hnp.

Usage

1
2
3
## S3 method for class 'hnp'
plot(x, cex, pch, colour, 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.

colour

vector of colours.

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.

Author(s)

Rafael A. Moral <rafael_moral@yahoo.com.br>, John Hinde and Clarice G. B. Demétrio

References

Moral, R. A., Hinde, J. and Demétrio, C. G. B. (2017) Half-normal plots and overdispersed models in R: the hnp package. Journal of Statistical Software 81(10):1-23.

Demétrio, C. G. B. and Hinde, J. (1997) Half-normal plots and overdispersion. GLIM Newsletter 27:19-26.

Hinde, J. and Demétrio, C. G. B. (1998) Overdispersion: models and estimation. Computational Statistics and Data Analysis 27:151-170.

Demétrio, 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

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

Example output

Loading required package: MASS
Analysis of Deviance Table

Model: poisson, link: log

Response: counts

Terms added sequentially (first to last)


          Df Deviance Resid. Df Resid. Dev  Pr(>Chi)    
NULL                         19     39.752              
treatment  3    30.43        16      9.323 1.121e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Poisson model 
Poisson model 

hnp documentation built on May 2, 2019, 12:40 p.m.