OKOn 12/12/2025 15:03, Sven Schreiber wrote:
I guess that this help predates the introduction of the mreverse() function?YesSo, OK to change the help example there? Or am I missing something?
Let's change it, yes. Could you please see to it?
Yes, I know that it depends on the implementation / normalization, but that's exactly the point of checking concrete code snippets: in the one I gave it seems to be identical. Of course, it could be that gretl doesn't guarantee the signs there in the future.
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>
Neater perhaps, but in fact the following variant seems to be faster:
<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.
Alright. Thanks,
sven