[R] Complex Survey Data and EFA

John Fox j|ox @end|ng |rom mcm@@ter@c@
Sat Apr 30 15:24:24 CEST 2022


Dear Lybrya,

I don't have personal experience with it, but to do parallel analyses, 
you'd have to simulate data according to the sampling design. That 
shouldn't be too hard but would require custom programming and you may 
be able to adapt existing code, such as that in the psych package.

You already have, in base R and the packages that you reference, what's 
necessary for computing scree plots and tetrachoric correlations.

Here, using an example in ?svyfactanal, is one way to get scree plots 
based on the correlation matrix with either 1's or communalities on the 
main diagonal:

library(survey)
example("factanal")
fa <- factanal(~api99+api00+hsg+meals+ell+emer, data=apipop, factors=2)
RR <- R <- fa$correlation
(u <- fa$uniquenesses)
diag(RR) <- 1 - u

plot(eigen(R, only.values=TRUE)$values, type="b",
      ylab=expression(lambda[i]), main="Scree Plot (correlations)")

plot(eigen(RR, only.values=TRUE)$values, type="b",
      ylab=expression(lambda[i]),
      main="Scree Plot (correlations with communalities)")

Here is an example of computing a polychoric correlation based on an 
example in ?svytable:

example("svytable")
library(polycor)
polychoric(tbl)

The example is nonsense in that the levels of stype in the table are out 
of order -- I show it here just to demonstrate how to do the 
computation. As well, stype has three levels, but polychoric() computes 
tetrachoric correlations when both variable are binary. I know that you 
want a correlation matrix for several binary variables, but it would be 
simple to compute them in a double for loop.

I hope this helps,
  John

-- 
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
web: https://socialsciences.mcmaster.ca/jfox/

On 2022-04-29 1:31 p.m., Lybrya Kebreab wrote:
> Hello,
> 
> Thank you for the help already received in conducting EFAs with complex samples. I have successfully generated the EFA with svyfactanal. I have been unsuccessful in using the survey weighted data to generate the extra bells and whistles of EFA such as scree plots and parallel analyses. I noticed there is a way to create scree plots in the ggplots (or ggplots2) package, but am wondering if the svyfactanal  function (or another function) in the survey package can generate these plots and subsequent parallel analyses.
> 
> I also have binary variables.  I can generate the EFA with the binary variables using the hetcor function within the polycor package--but without the complex sampling design. Is there a way to conduct the EFA  with binary items that also allows me to apply the design weights?
> 
> 
> Thank you kindly,
> 
> Lybrya Kebreab
> Doctoral Candidate
> Education-Mathematics Education Track
> School of Teacher Education
> College of Community Innovation and Education
> University of Central Florida
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using 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.



More information about the R-help mailing list