PRINFACTORS—Principal components factor analysis

Use this forum to post complete RATS "procedures". Please be sure to include instructions on using the procedure and detailed references where applicable.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

PRINFACTORS—Principal components factor analysis

Unread post by TomDoan »

@PRINFACTORS does a principal components based factor analysis of an input covariance or correlation matrix. The related procedure @PRINCOMP can be used if you just need to extract the series of principal components.

Detailed description
dniggeler@gmx.ch
Posts: 1
Joined: Thu Jul 12, 2007 11:18 am

Sign reversal

Unread post by dniggeler@gmx.ch »

Hi

Could you please explain to a Rats beginner why in contrast to other stats program I get eigenvectors with a flipped sign.

Thank you for your help,

Dieter.
BhFS Behavioural Finance Solutions GmbH
Dieter Niggeler
Plattenstrasse 32
8032 Zurich Switzerland
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Unread post by TomDoan »

The signs of eigenvectors are arbitrary. RATS uses a translation of EISPACK FORTRAN code which is probably almost identical to the newer LAPACK code. There's no sign choice in that at all; the signs of the eigenvectors are what they are based upon the input matrix and the order of calculations.

The sign choice is mathematically irrelevant - it only affects how easy it is to read the results. What sign choice is most useful will actually depend upon the situation. The recoding of PRINFACTORS makes the sum of the elements in an eigenvector positive. While this is arguably more useful than having the sign determined effectively randomly, I could think of situations where making the largest value positive would make it easier to read. (CATS, for instance, by default will normalize an eigenvector to make its largest element 1.0).
IRJ
Posts: 48
Joined: Wed Jan 10, 2007 1:15 am

Re: PRINFACTORS - updated version

Unread post by IRJ »

How can one extract the principal components from the procedure @prinfactors? More specifically, how can one obtain the output of the procedure @princomp using @prinfactors? And how can one normalize the eigenvectors in the two procedures so that the largest eigenvector takes a value of one?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: PRINFACTORS - updated version

Unread post by TomDoan »

IRJ wrote:How can one extract the principal components from the procedure @prinfactors? More specifically, how can one obtain the output of the procedure @princomp using @prinfactors? And how can one normalize the eigenvectors in the two procedures so that the largest eigenvector takes a value of one?
If you want the principal components, just use @PRINCOMP.

As an example of rescaling:

compute eigen=%ranmat(5,5)
dec vect maxv(%rows(eigen))
ewise maxv(i)=%maxvalue(%abs(%xcol(eigen,i)))
compute eigen=%ddivide(eigen,maxv)


Last bumped by TomDoan on Mon Apr 23, 2018 3:57 pm.
Post Reply