]> git.donarmstrong.com Git - ape.git/blobdiff - R/compar.gee.R
2nd try!!
[ape.git] / R / compar.gee.R
index f8a7b6ae43e217c51b79e8e79890f19021141358..488379c4b00d52775651515b4c3cba090790ba30 100644 (file)
@@ -1,4 +1,4 @@
-## compar.gee.R (2008-01-14)
+## compar.gee.R (2008-02-21)
 
 ##   Comparative Analysis with GEEs
 
@@ -20,18 +20,19 @@ do not match: the former were ignored in the analysis.")
     effect.assign <- attr(model.matrix(formula, data = data), "assign")
     for (i in all.vars(formula)) {
         if (any(is.na(eval(parse(text = i), envir = data))))
-          stop("the present method cannot (yet) be used directly with missing data: you may consider removing the species with missing data from your tree with the function `drop.tip'.")
+          stop("the present method cannot (yet) be used directly with missing data: you may consider removing the species with missing data from your tree with the function 'drop.tip'.")
     }
-    if (is.null(phy$edge.length))
-      stop("the tree has no branch lengths.")
+    if (is.null(phy$edge.length)) stop("the tree has no branch lengths.")
     R <- vcv.phylo(phy, cor = TRUE)
     id <- rep(1, dim(R)[1])
     geemod <- do.call("gee", list(formula, id, data = data, family = family, R = R,
                                   corstr = "fixed", scale.fix = scale.fix,
                                   scale.value = scale.value))
     W <- geemod$naive.variance
-    if (family == "binomial")
-      W <- summary(glm(formula, family = quasibinomial, data = data))$cov.scaled
+    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)))
     obj <- list(call = geemod$call,