]> git.donarmstrong.com Git - ape.git/blobdiff - R/Cheverud.R
a collection of bug fixes
[ape.git] / R / Cheverud.R
index ab7e24bb4eab18726bccab3ee5cc6c4da549c433..6b70a12bf193d11932a9c35a506e05eab0de9637 100644 (file)
@@ -12,7 +12,9 @@
 # Evolution 55(11): 2143-2160
 compar.cheverud <- function(y, W, tolerance=1e-6, gold.tol=1e-4)
 {
-  W <- W - diag(W) # ensure diagonal is zero
+  ## fix by Michael Phelan
+  diag(W) <- 0 # ensure diagonal is zero
+  ## end of fix
   y <- as.matrix(y)
   if(dim(y)[2] != 1) stop("Error: y must be a single column vector.")
   D <- solve(diag(apply(t(W),2,sum)))