inst/tinytest/test-median-dispersion.R

data("anorexia", package = "MASS")

anorexML <- glm(Postwt ~ Prewt + Treat+ offset(Prewt),
                family = gaussian, data = anorexia)
anorexBR <- update(anorexML, method = "brglmFit")
anorexMBR <- update(anorexML, method = "brglmFit", control = list(type="AS_median"))

tol <- sqrt(.Machine$double.eps)

## dispersion is RSS over residual degrees of freedom minus 2/3"
expect_equal(anorexMBR$dispersion, sum((anorexia$Postwt - fitted(anorexML))^2)/(nrow(anorexia) - length(coef(anorexML)) - 2/3))

Try the brglm2 package in your browser

Any scripts or data that you put into this service are public.

brglm2 documentation built on Oct. 12, 2023, 1:07 a.m.