Hi all,[...]
I'm currently comparing more closely the different ways of how to compute principal components, leading to some remarks or suggestions (and questions) about the respective documentation.
1) eigensym:
(i) The resulting eigenvalues are ascending, and there's a relatively complicated code example about how to get them in descending order, namely:
I guess that this help predates the introduction of the mreverse() function?Yes
So, OK to change the help example there? Or am I missing something?
Let's change it, yes. Could you please see to it?
2) princomp:
There's a verbal explanation of how they are computed, which I find difficult to follow.
Yes, that occurred to me too. I think we may want to reword it a little.
I have verified that the following computations coincide: [...]
That's not necessarily true, because the eigenvectors (and hence the principal components) are identified up to a sign switch. Moreover, there's an even neater way:
<hansl> clear A = mnormal(30,10) # SVD-based matrix ps = empty l = svd(cdemean(A), &ps) ps = ps .* l </hansl>
I think it would be helpful to include an example like this one in the princomp help. Or maybe a variant based on the correlation matrix (default in princomp) instead of the covariance like here. OK?
Fine by me.
------------------------------------------------------- Riccardo (Jack) Lucchetti Dipartimento di Scienze Economiche e Sociali (DiSES) Università Politecnica delle Marche (formerly known as Università di Ancona) r.lucchetti@univpm.it http://www2.econ.univpm.it/servizi/hpp/lucchetti -------------------------------------------------------