Skip to content

Commit

Permalink
Block glm tidiers for gee objects. Fixes #708.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpghayes committed Aug 13, 2019
1 parent c07371e commit ce212e7
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Expand Up @@ -355,7 +355,7 @@ Suggests:
survey,
survival,
systemfit,
testthat,
testthat (>= 2.1.0),
tseries,
xergm,
zoo
Expand Down
11 changes: 11 additions & 0 deletions R/gee.R
@@ -0,0 +1,11 @@
# mclogit subclasses glm, make sure to stop rather than erroneously
# use the glm tidiers

#' @export
tidy.gee <- tidy.default

#' @export
glance.gee <- glance.default

#' @export
augment.gee <- augment.default
41 changes: 41 additions & 0 deletions tests/testthat/test-gee.R
@@ -0,0 +1,41 @@
skip_if_not_installed("gee")
library(gee)

skip_if_not_installed("MASS")
library(MASS)

data(OME)

capture.output( # hack to prevent C level printing that can't be turned off
mod <- gee(
cbind(Correct, Trials - Correct) ~ Loud + Age + OME,
id = ID,
data = OME,
family = binomial,
corstr = "exchangeable",
silent = TRUE
)
)

test_that("tidy.glm() isn't invoked", {
expect_error(
tidy(mod),
"No tidy method for objects of class gee"
)
})

test_that("glance.glm() isn't invoked", {
expect_error(
glance(mod),
"No glance method for objects of class gee"
)
})

test_that("augment.glm() isn't invoked", {
expect_error(
augment(mod),
"No augment method for objects of class gee"
)
})

rm(mod)

0 comments on commit ce212e7

Please sign in to comment.