X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=R%2FCheverud.R;h=a2073d05aa7ca53ca1a5b93cb89a6cc8ef340eff;hb=f5c4abe6ac31486e821d82788bf66b5db2be51d1;hp=ab7e24bb4eab18726bccab3ee5cc6c4da549c433;hpb=c827059eeafc8cbe41c812b26979543ab287803e;p=ape.git diff --git a/R/Cheverud.R b/R/Cheverud.R index ab7e24b..a2073d0 100644 --- a/R/Cheverud.R +++ b/R/Cheverud.R @@ -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))) @@ -33,7 +35,7 @@ compar.cheverud <- function(y, W, tolerance=1e-6, gold.tol=1e-4) } sorted[ii] <- Re(sorted[ii]) # Remove imaginary part } - sorted <- as.real(sorted) + sorted <- as.double(sorted) Distinct <- numeric(0) Distinct[1] <- -Inf