Example #1
0
class TestCAResults(object):
    def setup(self):
        """Data from table 9.11 in Legendre & Legendre 1998."""
        X = np.loadtxt(get_data_path('L&L_CA_data'))
        self.ordination = CA(X)

    def test_scaling2(self):
        scores = self.ordination.scores(scaling=2)
        # p. 460 L&L 1998
        F_hat = np.array([[ 0.40887, -0.06955],
                          [-0.11539,  0.29977],
                          [-0.30997, -0.18739]])
        npt.assert_almost_equal(*normalize_signs(F_hat, scores.species),
                                decimal=5)
        V_hat = np.array([[-0.84896, -0.88276],
                          [-0.22046,  1.34482],
                          [ 1.66697, -0.47032]])
        npt.assert_almost_equal(*normalize_signs(V_hat, scores.site), decimal=5)

    def test_scaling1(self):
        scores = self.ordination.scores(scaling=1)
        # p. 458
        V = np.array([[ 1.31871, -0.34374],
                      [-0.37215,  1.48150],
                      [-0.99972, -0.92612]])
        npt.assert_almost_equal(*normalize_signs(V, scores.species), decimal=5)
        F = np.array([[-0.26322, -0.17862],
                      [-0.06835,  0.27211],
                      [ 0.51685, -0.09517]])
        npt.assert_almost_equal(*normalize_signs(F, scores.site), decimal=5)
Example #2
0
 def setup(self):
     """Data from table 9.11 in Legendre & Legendre 1998."""
     X = np.loadtxt(get_data_path('L&L_CA_data'))
     self.ordination = CA(X)
Example #3
0
import os
import numpy as np

from bipy.maths.stats.ordination import CA, RDA, CCA


path = os.path.dirname(os.path.abspath(__file__))


def get_path(fn):
    return os.path.join(path, os.pardir, 'maths', 'stats', 'ordination',
                        'test', 'data', fn)

X = np.loadtxt(get_path('L&L_CA_data'))
ordint = CA(X)
ordint.biplot(1)
ordint.biplot(2)

Y = np.loadtxt(get_path('example2_Y'))
X = np.loadtxt(get_path('example2_X')).reshape(-1, 4, order='F')
ordint = RDA(Y, X)
ordint.biplot()

Y = np.loadtxt(get_path('example3_Y'))
X = np.loadtxt(get_path('example3_X')).reshape(-1, 4, order='F')
ordint = CCA(Y, X)
ordint.biplot()