]> git.donarmstrong.com Git - ape.git/blobdiff - R/compar.gee.R
again...........
[ape.git] / R / compar.gee.R
index ecaa79aa9235a7cc5667101f261e3a9603f10725..e9075a1f724adf6a86ea9676bfa312ab19db385a 100644 (file)
@@ -1,8 +1,8 @@
-## compar.gee.R (2006-10-11)
+## compar.gee.R (2008-02-21)
 
 ##   Comparative Analysis with GEEs
 
-## Copyright 2002-2006 Emmanuel Paradis
+## Copyright 2002-2008 Emmanuel Paradis
 
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
@@ -10,6 +10,7 @@
 compar.gee <- function(formula, data = NULL, family = "gaussian", phy,
                        scale.fix = FALSE, scale.value = 1)
 {
+    require(gee, quietly = TRUE)
     if (is.null(data)) data <- parent.frame() else {
         if(!any(is.na(match(rownames(data), phy$tip.label))))
           data <- data[phy$tip.label, ]
@@ -29,7 +30,9 @@ do not match: the former were ignored in the analysis.")
                                   corstr = "fixed", scale.fix = scale.fix,
                                   scale.value = scale.value))
     W <- geemod$naive.variance
-    if (family == "binomial")
+    fname <-
+        if (is.function(family)) deparse(substitute(family)) else family
+    if (fname == "binomial")
       W <- summary(glm(formula, family = quasibinomial, data = data))$cov.scaled
     N <- geemod$nobs
     dfP <- sum(phy$edge.length)*N / sum(diag(vcv.phylo(phy)))