binom.diagnostics function

Diagnostics for Binary GLM

Diagnostics for Binary GLM

Two techniques for evaluating the adequacy of the binary glm model used in mlds, based on code in Wood (2006).

binom.diagnostics(obj, nsim = 200, type = "deviance", no.warn = TRUE) ## S3 method for class 'mlds.diag' plot(x, alpha = 0.025, breaks = "Sturges", ...)

Arguments

  • obj: list of class mlds typically generated by a call to the mlds
  • nsim: integer giving the number of sets of data to simulate
  • type: character indicating type of residuals. Default is deviance residuals. See residuals.glm for other choices
  • no.warn: logical indicating when TRUE (default) to suppress warnings from glm
  • x: list of class mlds.diag typically generated by a call to binom.diagnostics
  • alpha: numeric between 0 and 1, the envelope limits for the cdf of the deviance residuals
  • breaks: character or numeric indicating either the method for calculating the number of breaks or the suggested number of breaks to employ. See hist for more details.
  • ...: additional parameters specifications for the empirical cdf plot

Details

Wood (2006) describes two diagnostics of the adequacy of a binary glm model based on analyses of residuals (see, p. 115, Exercise 2 and his solution on pp 346-347). The first one compares the empirical cdf of the deviance residuals to a bootstrapped confidence envelope of the curve. The second examines the number of runs in the sorted residuals with those expected on the basis of independence in the residuals, again using a resampling based on the models fitted values. The plot method generates two graphs, the first being the empirical cdf and the envelope. The second is a histogram of the number of runs from the bootstrap procedure with the observed number indicated by a vertical line. Currently, this only works if the glm method is used to perform the fit and not the optim method

Returns

binom.diagnostics returns a list of class mlds.diag with components - NumRuns: integer vector giving the number of runs obtained for each simulation

  • resid: numeric matrix giving the sorted deviance residuals in each column from each simulation

  • Obs.resid: numeric vector of the sorted observed deviance residuals

  • ObsRuns: integer giving the observed number of runs in the sorted deviance residuals

  • p: numeric giving the proportion of runs in the simulation less than the observed value.

References

Wood, SN Generalized Additive Models: An Introduction with R, Chapman & Hall/CRC, 2006

Knoblauch, K. and Maloney, L. T. (2008) MLDS: Maximum likelihood difference scaling in R. Journal of Statistical Software, 25:2 , 1--26, tools:::Rd_expr_doi("10.18637/jss.v025.i02") .

Author(s)

Ken Knoblauch

See Also

mlds

Examples

## Not run: data(kk1) kk1.mlds <- mlds(kk1) kk1.diag <- binom.diagnostics(kk1.mlds) plot(kk1.diag) ## End(Not run)
  • Maintainer: Kenneth Knoblauch
  • License: GPL (>= 2)
  • Last published: 2023-08-20

Useful links