File: test-median-dispersion.R

package info (click to toggle)
r-cran-brglm2 0.9.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 872 kB
  • sloc: ansic: 52; makefile: 5
file content (12 lines) | stat: -rwxr-xr-x 507 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
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))