Last active
December 8, 2022 15:33
-
-
Save k-barton/c1df2e6b59bf947bbdd25cb410163e4f to your computer and use it in GitHub Desktop.
Standard methods for `phylo[g]lm` and `pglmm_compare` needed to use these model types with MuMIn functions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local({ | |
family.phylolm <- | |
function (object, ...) { | |
stop("???") | |
} | |
logLik.pglmm_compare <- | |
function (object, ...) { | |
rval <- object$logLik | |
attr(rval, "nobs") <- nrow(object$X) | |
attr(rval, "df") <- object$logLik + object$AIC / 2 | |
class(rval) <- "logLik" | |
rval | |
} | |
nobs.pglmm_compare <- | |
function (object, ...) { | |
nrow(object$X) | |
} | |
family.pglmm_compare <- | |
function (object, ...) { | |
switch(object$family, gaussian = , binomial =, poisson = | |
get(object$family, asNamespace("stats"))(), | |
stop(paste("family", sQuote(object$family), "not supported yet")) | |
) | |
} | |
registerS3method("logLik", "phyloglm", function (object, ...) { | |
rval <- object$logLik | |
attr(rval, "nobs") <- object$n | |
attr(rval, "df") <- object$d + 1 | |
class(rval) <- "logLik" | |
rval | |
}) | |
registerS3method("logLik", "pglmm_compare", logLik.pglmm_compare) | |
registerS3method("nobs", "phyloglm", MuMIn:::nobs.phylolm) | |
registerS3method("nobs", "pglmm_compare", nobs.pglmm_compare) | |
registerS3method("family", "pglmm_compare", family.pglmm_compare) | |
registerS3method("family", "phylolm", family.phylolm) | |
registerS3method("family", "phyloglm", family.phylolm) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment