[R] Polychoric Principal Component Analysis (pPCA)

William R Revelle revelle at northwestern.edu
Thu Apr 10 05:00:34 CEST 2014

I am not sure if anyone answered your question about doing biplots using polychoric output and PCA.

The biplot.psych  example # 3 shows how to do this

> responses <- table2df(bock.table[,2:6],count=bock.table[,7],
>                 labs= paste ("lsat6.",1:5,sep="”))

> W <- polychoric(responses, smooth=TRUE,global=TRUE,polycor=F, 
>             ML = FALSE,  std.err=FALSE,progress=TRUE) 
#this returns an object with both the correlations and the difficulties

#get the object returned by principal  (see biplot.psych  example 3)

p3 <- principal(r = W$rho, nfactors = 3, rotate = "Promax") # works if you actually give it the matrix

p3$scores <- factor.scores(responses,p3)   #find the scores from the response data set with the p3 pca solution


On Dec 17, 2013, at 2:18 PM, Peter Maclean <pmaclean2011 at yahoo.com> wrote:

> I have data set with binary responses. I would like to
> conduct polychoric principal component analysis (pPCA). I know there are several packages used in PCA but I could not find one that directly estimate pPCA and graph the individuals and variables maps. I will appreciate any help that expand these reproducible scripts.
> #How to conduct polychoric principal component analysis pPCA using 
> #either of these packages
> library(psych) 
> library(FactoMineR)
> library(nsprcomp)
> #Bock and Liberman (1970) data set of 1000 observations of the LSAT
> #from psych
> data(bock)
> responses <- table2df(bock.table[,2:6],count=bock.table[,7],
>                 labs= paste ("lsat6.",1:5,sep=""))
> fix(responses) 
> describe(responses)
> #Estimate the polychoric correlation matrix to be used in 
> #PCA using psych 
> W <- polychoric(responses, smooth=TRUE,global=TRUE,polycor=F, 
>             ML = FALSE,  std.err=FALSE,progress=TRUE) 
> #Regular PCA using stat, psych and FactoMiner, respectively
> #There is no option for including the matrix
> princomp(responses, cor=TRUE) #What kind of correlation is used here?
> principal(r = responses, nfactors = 3, rotate = "Promax")
> principal(r = W, nfactors = 3, rotate = "Promax") #Do not work
> PCA(responses, scale.unit=TRUE, ncp=3, graph=T) 
> #How to conduct polychoric principal component analysis using either of #the above package and producing individual and variable factor maps as #above
> Peter Maclean
> Department of Economics
> ______________________________________________
> 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.

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 5 minutes to midnight	   http://www.thebulletin.org

More information about the R-help mailing list