OK, old dude here: there's no automatic way to save the loading
vectors from principal
components analysis, but it's easy to compute them yourself. The
script below does
the job (and also shows the equivalence between manual calculation and
the princomp()
function:
<script>
open data7-12
matrix X = {wbase, length, width, height, weight}
matrix C = mcorr(X) # or mcov() if you prefer
matrix E
eigensym(C, &E)
# the loading vectors: sort by decreasing eigenvalue
E = mreverse(E')'
print E
# compute PCA via princomp() and manually
P1 = princomp(X,5)
scalar n = rows(X)
scalar k = cols(X)
# normalize X
X = X .- meanc(X)
X = X ./ sdc(X,n-1)
matrix P2 = zeros(n, k)
loop i=1..n -q
loop j=1..k -q
P2[i,j] = X[i,] * E[,j]
endloop
endloop
print P1 P2
</script>
Allin Cottrell
On Sun, Jun 12, 2011 at 1:39 PM, Anutechia Asongu
<simplice_peace(a)yahoo.com> wrote:
>
> Sorry Amaryl, I can't help as I'm a young user of this stuff. Sure, some
old dudes here will provide you an answer shortly.
>
>
> --- On Sun, 6/12/11, amaryl <amaryl.felicia(a)gmx.de> wrote:
>
> From: amaryl <amaryl.felicia(a)gmx.de>
> Subject: Re: [Gretl-users] Storing the loadings of principal component analysis
> To: "Gretl list" <gretl-users(a)lists.wfu.edu>
> Date: Sunday, June 12, 2011, 5:28 AM
>
> Thanks for your reply.
> But as far as I can see, this saves the principal components (which are
> time series). What I need, is the matrix of loadings, which describes
> how the series of principal components "contribute" to the original data
> series.
>
> To put it in more technical terms, I would like to access the
> eigenvectors of the correlation matrix themselves, not just the
> principal components computed from these eigenvectors.
>
>
> On Sun, 2011-06-12 at 05:02 -0700, Anutechia Asongu wrote:
> >
> > Click on the plus(+) sign on top of the window showing ur PCA results
> > and save the result on ur main Grelt Window.
> >
> >
> >
> > --- On Sun, 6/12/11, amaryl <amaryl.felicia(a)gmx.de> wrote:
> >
> > From: amaryl <amaryl.felicia(a)gmx.de>
> > Subject: [Gretl-users] Storing the loadings of principal
> > component analysis
> > To: gretl-users(a)lists.wfu.edu
> > Date: Sunday, June 12, 2011, 3:57 AM
> >
> > Dear all,
> >
> > is there a way to store the component loadings as a matrix
> > after doing a
> > principal component analysis? I get the loadings as output, of
> > course,
> > but I need them for further processing.
> >
> > Thanks in advance!
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users