checkDisp: Reproduce data for the linear model scale-location diagnostic...

View source: R/checkDisp.R

checkDispR Documentation

Reproduce data for the linear model scale-location diagnostic plot

Description

The values returned are those used for plot(x.lm, which=3), where x.lm is a linear model or a generalized linear model. Plot the object returned to assess how successful the weights, determined using the function scaleLocAdjust, have been in adjusting for heterogenous variances.

Usage

checkDisp(x, span = 0.75)

Arguments

x

Model fitted using lm() or glm()

span

span parameter for use in smoothing the square root of standardized deviance residuals.

Value

A data frame, with:

linpred

Predicted values, on the scale of the linear predictor

absrSmooth

Smoothed values of the square roots of absolute values of standardised deviance residuals.

Examples

royal <- subset(qra::codling1988, Cultivar=="ROYAL")
royal.glm <- glm(cbind(dead,total-dead)~ct, data=royal,
                 family=quasibinomial(link='cloglog'))
royalFix <- qra::scaleLocAdjust(royal.glm, lambda=2)
## Check range of indicated prior weights
range(royalFix[[2]])
## Range of updated dispersion estimates
range(summary(royalFix[[1]])[['dispersion']]/royalFix[[2]])
xy <- qra::checkDisp(royalFix[[1]])
plot(xy)

jhmaindonald/qra-R-package documentation built on Nov. 16, 2023, 2:39 p.m.