Skip to content

Instantly share code, notes, and snippets.

@k-barton
Last active December 8, 2022 15:47
Show Gist options
  • Save k-barton/b11c7c6b8d1f064c91278d37e740a066 to your computer and use it in GitHub Desktop.
Save k-barton/b11c7c6b8d1f064c91278d37e740a066 to your computer and use it in GitHub Desktop.
Methods for `ape:compar.gee` needed to use these model types with MuMIn functions.
require("MuMIn")
local({
quasiLik.compar.gee <-
function (object, ...) {
scale <- object$scale
ret <- .qlik(object$residuals + object$fitted.values, object$fitted.values,
get(object$family, envir = asNamespace("stats"))(),
1, scale)
attr(ret, "df") <- NA
attr(ret, "nobs") <- length(object$residuals)
class(ret) <- "quasiLik"
ret
}
environment(quasiLik.compar.gee) <- asNamespace("MuMIn")
registerS3method("quasiLik", "compar.gee", quasiLik.compar.gee,
envir = asNamespace("MuMIn"))
coefTable.compar.gee <-
function (model, ...) {
.makeCoefTable(model$coefficients, sqrt(diag(model$W)))
}
environment(coefTable.compar.gee) <- asNamespace("MuMIn")
registerS3method("coefTable", "compar.gee",
coefTable.compar.gee, envir = asNamespace("MuMIn"))
assignInNamespace("isGEE", function (object)
inherits(object, c("geeglm", "geese", "gee", "geem", "wgee",
"compar.gee", "yagsResult")), ns = "MuMIn")
registerS3method("getQIC", "compar.gee", function (x, ...)
c(x$QIC, n = x$nobs), envir = asNamespace("MuMIn")
)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment