Am 06.03.2012 00:18, schrieb Allin Cottrell:
On Mon, 5 Mar 2012, Henrique Andrade wrote:
> Dear Gretl Community,
>
> In a "Principal Component Analysis" context, is there an accessor that can
> be used for retrieve the component loading coefficients into a matrix?
No, but you can easily get such a matrix by using eigensym() on the
correlation (or covariance) matrix of the list of series (converted
to a matrix). Example:
<hansl>
open data7-12
list L = wbase length width height weight cyl liters
matrix C = mcorr({L})
matrix V
eigensym(C,&V)
print V # eigenvectors = loadings
# compare the PCA printout
pca L
</hansl>
Note that eigensym() orders things by ascending value, so the
loadings associated with the first principal component are in the
last column of V.
I'm wondering whether there may be a case to extend the princomp()
function somewhat to get a direct access to that (optional third matrix
parameter in pointer form for example). Sure it would be sort of
redundant from a syntactic point of view, but since those eigenvectors
have to be computed anyway it could be an efficient way to get those.
cheers,
sven