Skip to content

Commit

Permalink
Merge branch 'issue-#189'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jari Oksanen committed Aug 17, 2016
2 parents 25f18f8 + 07f1857 commit 24bd366
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions R/goodness.cca.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@
else
pCCA <- diag(crossprod(pCCA))/nr
}
CA <- t(apply(diag(w) %*% CA^2 %*% diag(eig), 1,
cumsum))
CA <- t(apply(
diag(w, length(w)) %*% CA^2 %*% diag(eig, length(eig)),
1, cumsum))
## rank=1 solutions comes out transposed: back transpose
if (length(eig) == 1)
CA <- t(CA)
totals <- inertcomp(object, display = display)
comps <- colnames(totals)
if (statistic == "explained") {
Expand Down
6 changes: 4 additions & 2 deletions R/inertcomp.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
pCCA <- diag(crossprod(pCCA))/nr
}
if (!is.null(CCA))
CCA <- rowSums(diag(w) %*% CCA^2 %*% diag(object$CCA$eig))
CCA <- rowSums(diag(w, length(w)) %*% CCA^2 %*%
diag(object$CCA$eig, length(object$CCA$eig)))
if (!is.null(CA))
CA <- rowSums(diag(w) %*% CA^2 %*% diag(object$CA$eig))
CA <- rowSums(diag(w, length(w)) %*% CA^2 %*%
diag(object$CA$eig, length(object$CA$eig)))
out <- cbind(pCCA, CCA, CA)
if (statistic == "distance" && !proportional) {
w <- weights(object, display = display)
Expand Down

0 comments on commit 24bd366

Please sign in to comment.