[R] What is the difference between prcomp and princomp?

Peng Yu pengyu.ut at gmail.com
Tue Oct 20 03:02:18 CEST 2009


On Mon, Oct 19, 2009 at 9:31 AM, Peng Yu <pengyu.ut at gmail.com> wrote:
> On Mon, Oct 19, 2009 at 5:02 AM, Mark Difford <mark_difford at yahoo.co.uk> wrote:
>>
>> Peng Yu wrote:
>>
>>>> Some webpage has described prcomp and princomp, but I am still not
>>>> quite sure what the major difference between them is.
>>
>> The main difference, which could be extracted from the information given in
>> the help files, is that prcomp uses the singular value decomposition [i.e.
>> does not rely eigenanalysis], which "is generally the preferred method for
>> numerical accuracy."
>>
>> There is plenty of information on the web about the differences between R-
>> and Q-mode PCA.
>
> If prcomp is always better than princomp, why there is still princomp
> in R? Are there any cases in which I should use princomp instead of
> prcomp? I don't find the argument 'cor' in prcomp as in princomp. Is
> 'cor' available in prcomp?

It seems that prcomp has 'scale' which is equivalent to 'cor' of
princomp. It seems that prcomp is almost the same as princomp in terms
of the function, and prcomp is numerically more stable than princomp.
If this is the case, then there is not a need to keep princomp in R.
I'm wondering why princomp is still in R. Do it provide something that
prcomp can not do?

> I'm reading the book Principle Component Analysis by I.T. Jolliffe.
> But I don't find the relevant discussion on R-mode and Q-mode. Would
> you please point me a good reference on this?

Could somebody point me a book on R-mode and Q-mode? Thank you!

>>> Some webpage has described prcomp and princomp, but I am still not
>>> quite sure what the major difference between them is. Can they be used
>>> interchangeably?
>>>
>>> In help, it says
>>>
>>>      'princomp' only handles so-called R-mode PCA, that is feature
>>>      extraction of variables.  If a data matrix is supplied (possibly
>>>      via a formula) it is required that there are at least as many
>>>      units as variables.  For Q-mode PCA use 'prcomp'.
>>>
>>>
>>> What are R-mode and Q-mode? Are they just too different numerical
>>> methods to compute PCA?
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/What-is-the-difference-between-prcomp-and-princomp--tp25952965p25955831.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>




More information about the R-help mailing list