statsmodels.sandbox.tools.tools_pca.pcasvd

statsmodels.sandbox.tools.tools_pca.pcasvd(data, keepdim=0, demean=True)[source]

principal components with svd

Parameters:

data : ndarray, 2d

data with observations by rows and variables in columns

keepdim : integer

number of eigenvectors to keep if keepdim is zero, then all eigenvectors are included

demean : boolean

if true, then the column mean is subtracted from the data

Returns:

xreduced : ndarray, 2d, (nobs, nvars)

projection of the data x on the kept eigenvectors

factors : ndarray, 2d, (nobs, nfactors)

factor matrix, given by np.dot(x, evecs)

evals : ndarray, 2d, (nobs, nfactors)

eigenvalues

evecs : ndarray, 2d, (nobs, nfactors)

eigenvectors, normalized if normalize is true

See Also

pca : principal component analysis using eigenvector decomposition

Notes

This doesn’t have yet the normalize option of pca.