@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.

@PRINFACTORS( options )  sigma

Parameters

 sigma The input covariance or correlation matrix

Options

NCOMPS=number of components desired [number of variables]

SIGMAHAT=(output) sigma matrix [not used]

VECTORS=(output) RECTANGULAR of eigenvectors [not used]

VALUES=(output) VECTOR of eigenvalues [not used]

COMMUNALITIES=(output) VECTOR of communalities for variables [not used]

PRINT/[NOPRINT]

Controls whether the output will be displayed. @PRINFACTORS is mainly used for its outputs.

Example

*

* Tsay, Analysis of Financial Time Series, 3rd edition

* Example 9.1, pp 485-488

*

open data m-5clog-9008.txt

calendar(m) 1980:1

data(format=prn,org=columns) 1980:01 1998:12 ibm hpq intc jpm bac

*

* Compute the covariance matrix of the return series

*

vcv(center,matrix=r)

# ibm hpq intc jpm bac

*

* Do the principal components analysis on the correlation matrix.

*

@prinfactors(print,values=evalues) %cvtocorr(r)

*

* Pull out the eigenvalues and graph them

*

set eigen 1 5 = evalues(t)

graph(style=symbols,vlabel="Eigenvalue",hlabel="Component",nodates)

# eigen

Sample Output

Principal Components Analysis

Eigenvalue   2.607649  1.071584  0.568616  0.451315  0.300836

Proportion   0.521530  0.214317  0.113723  0.090263  0.060167

Cumulative   0.521530  0.735847  0.849570  0.939833  1.000000

Eigenvector -0.427633 -0.341113  0.837079  0.001756  0.008203

-0.459893 -0.356458 -0.380141 -0.704282  0.144622

-0.451115 -0.385464 -0.389227  0.704231  0.021777

-0.478567  0.469467 -0.045824 -0.052077 -0.738757

-0.416049  0.622573  0.034557  0.073012  0.657861