[R] PCA - princomp can only be used with more units than variables

Joshua Wiley jwiley.psych at gmail.com
Wed Jul 20 04:56:18 CEST 2011


On Mon, Jul 18, 2011 at 10:48 AM, a.mewes at yahoo.co.uk
<a.mewes at yahoo.co.uk> wrote:
> Ok thank you Josh.
>
> Basically I have a matrix A with 7 rows and 18 columns.

If i < j (where i is the number of rows in your matrix and j is the
number of columns), then the determinant of the covariance (or
correlation) matrix |Sigma_A| will be 0 (or very near zero, you can
easily convince yourself of this by running det(cov(matrix(rnorm(90),
9))) as many times as you need).  From Cramer's Rule, if the
determinant of the matrix is 0, there is not a unique solution
(clarifications/corrections are welcome if any of this is wrong).


>
> What I am told is I need the 'varimax rotated scores from the PCA analysis
> of matrix A'

Who told you that?  Is this homework?  You could look at the
?principal function in package "psych".  That said, if this is
homework I would talk with your instructor more, and if this is
anything beyond an exercise (i.e., has real world implications), I
would seek the advice/help of a local statistician.

>
> I can choose from 3 up to 7 components. My problem is how to carry out the
> above.
>
> Have you any ideas?
>
> Would appreciate your help!
>
> Armin
>
> On 18/07/2011 18:07, Joshua Wiley wrote:
>>
>> Hi,
>>
>> You need to explain what you want to do.  This is not a software
>> issue, you simply cannot create more uncorrelated variables than you
>> have observations.
>>
>> Josh
>>
>> On Mon, Jul 18, 2011 at 8:53 AM, a.mewes at yahoo.co.uk
>> <a.mewes at yahoo.co.uk>  wrote:
>>>
>>> Hi,
>>>
>>> May I ask a question about a thread
>>> https://stat.ethz.ch/pipermail/r-help/2005-March/068365.html?
>>>
>>> I understand I need to use prcomp instead of princomp when i have less
>>> units than variables.
>>>
>>> However, when I use prcomp the scores is NULL. How can I overcome this?
>>>
>>> Regards,
>>>
>>> Armin
>>>
>>> --
>>> Kind Regards,
>>>
>>> Armin Mewes
>>> Groundesign
>>> 10 Jerusalem street
>>> Belfast
>>> BT7 1QN
>>>
>>> Tel.    (0044)(0)2890280887
>>> Email.  enquiries at groundesign.net
>>> www.    www.groundesign.net
>>>
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> 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.
>>>
>>
>>
>
>
> --
> Kind Regards,
>
> Armin Mewes
> Groundesign
> 10 Jerusalem street
> Belfast
> BT7 1QN
>
> Tel.    (0044)(0)2890280887
> Email.  enquiries at groundesign.net
> www.    www.groundesign.net

-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
https://joshuawiley.com/



More information about the R-help mailing list