Learn R Programming

qra (version 0.2.7)

scaleLocAdjust: Estimate dispersion as a function of predicted values

Description

A loess smooth is applied to the square roots of the standardized deviance residuals. The inverses of values from the smooth, raised to the power of lambda, are then used as prior weights to update the model. A value of lambda that is a little more than 2.0 has often worked well.

Usage

scaleLocAdjust(x, lambda = 2, span = 0.75)

Arguments

x

Model fitted using glm or, possibly lm

lambda

Power of smooth of square roots of absolute values of residuals, to try for values whose inverses will be used as weights

span

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

Value

A list, with elements

model

Model updated to use the newly calculated weights

estDisp

Estimated dispersions

Details

This function is primarily for experimental use, in investigating possible ways to model a dispersion factor that varies with the fitted value.

See Also

checkDisp

Examples

Run this code
# NOT RUN {
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)
## Check range of indicated prior weights
range(ROYALFix[[2]])
## Range of updated dispersion estimates
range(summary(ROYALFix[[1]])[['dispersion']]/ROYALFix[[2]])
# }

Run the code above in your browser using DataLab