pydiodon.pca_iv¶
- pydiodon.pca_iv(A, B, k=- 1, meth='svd', pretreatment='col_centering', transpose=False)[source]¶
PCA of an array with instrumental variables
- Parameters
- Aa numpy array, the items/variable to be analyzed
- Ba numpy array, the intrumental variables
- kan integer
- metha string ; method for numerical calculation
- pretreatmenta string, the pretreatment of A and B
currently, only `col_centering`is implemented
- Returns
- Ya n x k 2D numpy array
the components
- La k 1D numpy array
the eigenvalues
- Va p x k 2D numpy array
the new basis
- A_proja n x p 2D numpy array
the projection of A on the subspace of \(R^n\) spanned by the columns of B
Notes
A_pre is a copy of A for tracking preatreatments, and recover the matrix analyzed after preatreatments, without impacting A
The algorithm is as follows:
Build \(P = B(B'B)^{-1}B'\) which is the projector in \(R^n\) on the subspace spanned by the columns of B.
build A_proj = PA which is the projection of A on the subspace spanned by the columns of B
do PCA of A_proj : Y,L,V = PCA(A_proj)
warning
This has not been tested; no guarantee on the quality of the result.
21/02/2018, révised 22.09.28, 22.10.14