[R] PCA - princomp can only be used with more units than variables
Michael Dewey
info at aghmed.fsnet.co.uk
Wed Jul 20 12:42:06 CEST 2011
At 03:56 20/07/2011, Joshua Wiley wrote:
>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'
You should be able to get scores on the first 7
components from prcomp surely? Is that not what
it returns in x or am I misreading the
documentation? Whether it is sensible to do this
with such a small dataset and in particular
whether rotating principal components is illogical I would not comment on.
>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/
Michael Dewey
info at aghmed.fsnet.co.uk
http://www.aghmed.fsnet.co.uk/home.html
More information about the R-help
mailing list