[R] PCA - scores

Joshua Wiley jwiley.psych at gmail.com
Fri Mar 4 02:15:34 CET 2011


Hi Shari,

Yes, please look at the documentation for principal.  You can access
this (assuming you have loaded psych) by typing at the console:

?principal

note the logical argument "scores".

Here is a small example:

##############################
require(psych)
require(GPArotation)

dat <- principal(mtcars[, c("mpg", "hp", "wt")], nfactors = 1,
  rotate = "oblimin", scores = TRUE)

dat$scores
##############################

Cheerio,

Josh

On Thu, Mar 3, 2011 at 1:02 PM, Shari Clare <sclare at ualberta.ca> wrote:
> I am running a PCA, but would like to rotate my data and limit the
> number of factors that are analyzed.  I can do this using the
> "principal" command from the psych package [principal(my.data,
> nfactors=3,rotate="varimax")], but the issue is that this does not
> report scores for the Principal Components the way "princomp" does.
>
> My question is:
>
> Can you get an output of scores using "principal" OR, is there a way
> to limit the number of factors that are included when you use
> "princomp"?
>
> Thanks,
> Shari Clare
>
> PhD Candidate
> Department of Renewable Resources
> University of Alberta
> sclare at ualberta.ca
> 780-492-2540
>
>
>
>
>
>
>
>
>        [[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.
>



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



More information about the R-help mailing list