[R] Extracting Factor Pattern Matrix Similar to Proc Factor

William Revelle lists at revelle.net
Tue Feb 24 02:03:55 CET 2015


David and Scott,
 principal will also take a covariance matrix (set the cover option to TRUE)


library(psych)
C <- cov(iris[-5])
pc4 <- principal(C,4,covar=TRUE,rotate="none”)

However, in the case of no rotation or orthogonal rotations, the structure matrix and the pattern matrix are identical.

They differ only if you take an oblique solution.
So, 

pc4 #will give you the results 
print(pc4$loadings,cutoff=0) #will give the loadings (pattern)
print(pc4$Structure,cutoff=0)   #will give the structure matrix

If the input is a covariance matrix, and you want to do the analysis on the correlation matrix, principal does that automatically.

C <- cov(iris[-5])
pc4 <- principal(C,4,rotate="none”)
pc4

Bill



> On Feb 23, 2015, at 3:58 PM, David L Carlson <dcarlson at tamu.edu> wrote:
> 
> Function principal() in psych takes a correlation matrix so use cov2cor() to convert:
> 
> library(psych)
> iris.pca <- principal(cov2cor(cov(iris[,-5])), nfactors=4, rotate="none")
> print(iris.pca$Structure, cutoff=0)
> 
> David
> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Scott Colwell
> Sent: Monday, February 23, 2015 3:34 PM
> To: r-help at r-project.org
> Subject: Re: [R] Extracting Factor Pattern Matrix Similar to Proc Factor
> 
> Thanks David. What do you do when the input is a covariance matrix rather
> than a dataset?
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Extracting-Factor-Pattern-Matrix-Similar-to-Proc-Factor-tp4703704p4703719.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
> 

William Revelle		           http://personality-project.org/revelle.html
Professor			           http://personality-project.org
Department of Psychology   http://www.wcas.northwestern.edu/psych/
Northwestern University	   http://www.northwestern.edu/
Use R for psychology             http://personality-project.org/r
It is 3 minutes to midnight	   http://www.thebulletin.org



More information about the R-help mailing list