pydiodon.coa¶
- pydiodon.coa(X, k=- 1, meth='svd', transpose=False)[source]¶
Correspondance Analysis of an array
- Parameters
- Xa 2D numpy array, n x p
array to be analysed
- kan integer
number of axis to compute
default is $k=-1$ (all components are cimputed)
- metha string
method for numerical computing
one string among evd, svd, grp (see notes)
default value is $svd$
- transposea boolean
if True, matrix $A$ is transposed (usually because n < p)
default is False
- Returns
- La 1D numpy array
the eigenvalues
- Y_ra 2D numpy array,`n x k`
coordinates of row points
- Y_ca 2D numpy array, p x k
coordinates of column points
Notes
If \(k=-1\), all axis are computed. If \(k > 0\), only k first axis and components are computed.
methods for SVD
svd
SVD with numpy.linalg.svd()
grp
SVD with gaussian random projection
Example
This example should be run from the directory where diodon_companion has been cloned for the dataset example_coa to be found.
>>> import pydiodon as dio >>> A, headers, rownames = dio.load("example_coa") >>> L, Y_r, Y_c = dio.coa(A)
and, to plot the row and column components
>>> dio.plot_coa(Y_r,Y_c, rownames=rownames, colnames=headers)
note on the example
The dataset is in text format with tabs as delimiters. It contains headers and row names. These are default parameters for functions dio.load()
References:
Nenadic & Greenacre, Journal of Statistical Software, 20(3): 2-13, 2007
Lebart, Morineau & Fénelon, 1982, pp. 305-320
af, revised 21.02.21, 22.11.05, 23.06.13