Current CCA code fails if the contingency matrix has any column with no observations, but vegan's R doesn't.
However, in R both sol and sol2 have the same results (Yval has a few columns with no observations):
library(vegan)
X <- read.table('Xval')
Y <- read.table('Yval')
nonzero <- apply(Y, 2, sum) != 0
sol <- cca(Y[, nonzero], X)
sol2 <- cca(Y, X)
and they match the current python implementation
from ordination import CCA
import numpy as np
X = np.loadtxt('Xval')
Y = np.loadtxt('Yval')
nonzero = Y.sum(axis=0) != 0
sol = CCA(Y[:, nonzero], X)
Maybe we can just remove those columns in __init__ and be careful with names (warning the user "hey, {n_cols} of the contingency matrix had no observations, they were dropped in the analysis.")
Current CCA code fails if the contingency matrix has any column with no observations, but vegan's R doesn't.
However, in R both sol and sol2 have the same results (Yval has a few columns with no observations):
and they match the current python implementation
Maybe we can just remove those columns in
__init__and be careful with names (warning the user "hey, {n_cols} of the contingency matrix had no observations, they were dropped in the analysis.")