6

Major UPDATE based on discussion with Aleksandr Blekh's answer (thanks so much!):

This MRE would run with no problem in R-Fiddle

library(psych)

data(bock)

fa.parallel.poly(lsat6)

Output from R-Fiddle (Graph omitted as not relevant with error), no difference in no of factors suggested by the first and second line

 See the graphic output for a description of the results
Parallel analysis suggests that the number of factors =  3  and the number of components =  1 
Call: fa.parallel.poly(x = lsat6)
Parallel analysis suggests that the number of factors =  3  and the number of components =  1 

 Eigen Values of 
  Original factors Simulated data Original components simulated data
1             0.79           0.76                1.62           1.22
2             0.14           0.13                1.00           1.10
3             0.04           0.03                0.88           1.00

Output from R-Studio (Graph omitted as not relevant with error), note there are difference in no of factors suggested by the first (3) and second line (0), and the eigen Values section looks like messed up

 See the graphic output for a description of the results
Parallel analysis suggests that the number of factors =  3  and the number of components =  1 
Call: fa.parallel.poly(x = lsat6)
Parallel analysis suggests that the number of factors =  0  and the number of components =  1 

 Eigen Values of 
  Original factors Simulated data Original components simulated data   NA   NA   NA   NA   NA   NA   NA   NA    NA
1             0.79              1                  10           0.58 0.39 0.39 0.57 0.29 0.19 1.06 0.87 0.26 -2.02
    NA   NA NA NA   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA   NA
1 0.12 1.62  1 10 1.17 0.04 1.15 1.16 0.03 1.11 1.24 0.14 0.58 -1.03 0.01

Here is the fresh results from R-studio together with sessionInfo() and options():

R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin10.8.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(psych)
> 
> data(bock)
> 
> fa.parallel.poly(lsat6)


  fa.parallel.poly |....................................................................................................| 100%

 See the graphic output for a description of the results
Parallel analysis suggests that the number of factors =  3  and the number of components =  1 
Call: fa.parallel.poly(x = lsat6)
Parallel analysis suggests that the number of factors =  0  and the number of components =  1 

 Eigen Values of 
  Original factors Simulated data Original components simulated data   NA   NA   NA   NA   NA   NA   NA   NA    NA
1             0.79              1                  10           0.58 0.39 0.39 0.57 0.29 0.19 1.06 0.87 0.26 -2.02
    NA   NA NA NA   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA   NA
1 0.12 1.62  1 10 1.17 0.04 1.15 1.16 0.03 1.11 1.24 0.14 0.58 -1.03 0.01
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] psych_1.5.1

loaded via a namespace (and not attached):
[1] mnormt_1.5-1   parallel_3.0.2 tools_3.0.2   
> options()
$add.smooth
[1] TRUE

$bitmapType
[1] "quartz"

$browser
function (url) 
{
    .Call("rs_browseURL", url)
}
<environment: 0x7fd21312cdc8>

$browserNLdisabled
[1] FALSE

$buildtools.check
    function (action) 
    {
        if (identical(.Platform$pkgType, "mac.binary.mavericks")) {
        .Call("rs_canBuildCpp")
    }
    else {
        if (!.Call("rs_canBuildCpp")) {
            .rs.installBuildTools(action)
            FALSE
        }
        else {
            TRUE
        }
    }
}
<environment: 0x7fd2131ecbc8>

$buildtools.with
function (code) 
{
    .rs.addRToolsToPath()
    on.exit(.rs.restorePreviousPath(), add = TRUE)
    force(code)
}
<environment: 0x7fd2131ecbc8>

$CBoundsCheck
[1] FALSE

$check.bounds
[1] FALSE

$citation.bibtex.max
[1] 1

$continue
[1] "+ "

$contrasts
        unordered           ordered 
"contr.treatment"      "contr.poly" 

$defaultPackages
[1] "datasets"  "utils"     "grDevices" "graphics"  "stats"     "methods"  

$demo.ask
[1] "default"

$deparse.cutoff
[1] 60

$device
[1] "RStudioGD"

$device.ask.default
[1] FALSE

$digits
[1] 7

$dvipscmd
[1] "dvips"

$echo
[1] TRUE

$editor
[1] "vi"

$encoding
[1] "native.enc"

$error
(function () 
{
    .rs.breakOnError(TRUE)
})()

$example.ask
[1] "default"

$expressions
[1] 5000

$ggvis.renderer
[1] "svg"

$help_type
[1] "html"

$help.search.types
[1] "vignette" "demo"     "help"    

$help.try.all.packages
[1] FALSE

$HTTPUserAgent
[1] "R (3.0.2 x86_64-apple-darwin10.8.0 x86_64 darwin10.8.0)"

$internet.info
[1] 2

$keep.source
[1] TRUE

$keep.source.pkgs
[1] FALSE

$locatorBell
[1] TRUE

$mailer
[1] "mailto"

$max.print
[1] 10000

$menu.graphics
[1] FALSE

$na.action
[1] "na.omit"

$nwarnings
[1] 50

$OutDec
[1] "."

$pager
function (files, header, title, delete.file) 
{
    for (i in 1:length(files)) {
        if ((i > length(header)) || !nzchar(header[[i]])) 
            fileTitle <- title
        else fileTitle <- header[[i]]
        .Call("rs_showFile", fileTitle, files[[i]], delete.file)
    }
}
<environment: 0x7fd2131ecbc8>

$papersize
[1] "a4"

$pdfviewer
[1] "/usr/bin/open"

$pkgType
[1] "mac.binary"

$printcmd
[1] "lpr"

$prompt
[1] "> "

$repos
                     CRAN 
"http://cran.rstudio.com" 
attr(,"RStudio")
[1] TRUE

$restart
function (afterRestartCommand = "") 
{
    afterRestartCommand <- paste(as.character(afterRestartCommand), 
        collapse = "\n")
    .Call("rs_restartR", afterRestartCommand)
}
<environment: 0x7fd2131ecbc8>

$rl_word_breaks
[1] " \t\n\"\\'`><=%;,|&{()}"

$scipen
[1] 0

$show.coef.Pvalues
[1] TRUE

$show.error.messages
[1] TRUE

$show.signif.stars
[1] TRUE

$str
    $str$strict.width
[1] "no"

$str$digits.d
[1] 3

$str$vec.len
[1] 4


$str.dendrogram.last
[1] "`"

$stringsAsFactors
[1] TRUE

$texi2dvi
[1] "/usr/bin/texi2dvi"

$timeout
[1] 60

$ts.eps
[1] 1e-05

$ts.S.compat
[1] FALSE

$unzip
[1] "/usr/bin/unzip"

$useFancyQuotes
[1] TRUE

$verbose
[1] FALSE

$viewer
function (url, height = NULL) 
{
    if (!is.character(url) || (length(url) != 1)) 
        stop("url must be a single element character vector.", 
            call. = FALSE)
    if (identical(height, "maximize")) 
        height <- -1
    if (!is.null(height) && (!is.numeric(height) || (length(height) != 
        1))) 
        stop("height must be a single element numeric vector or 'maximize'.", 
            call. = FALSE)
    invisible(.Call("rs_viewer", url, height))
}
<environment: 0x7fd21312cdc8>

$warn
[1] 0

$warning.length
[1] 1000

$width
[1] 119
ceoec
  • 524
  • 1
  • 4
  • 16

1 Answers1

4

Pay attention to the plot's y-axis label. It says: "Eigen values of original and simulated factors and components" (emphasis mine). Parallel analysis (PA) produces separate sets of eigen values for both factors (factor analysis, FA) and components (principal component analysis, PCA). While FA and PCA seem to be similar, those methods are conceptually different. Here's how Professor William Revelle (well-known expert in psychometric theory, maintainer of the Personality Project and the author of psych R package) explains the difference (Revelle, 2015, p. 158):

Although on the surface, the component model and factor model appear to very similar (...), they are logically very different. In the components model, components are linear sums of the variables. In the factor model, on the other hand, factors are latent variables whose weighted sum accounts for the common part of the observed variables. In path analytic terms, for the component model, arrows go from the variables to the components, while in the factor model they go from the factors to the variables.

My statement above about the contents of the plot is intentionally not very accurate for pedagogical reasons (but, I hope still conceptually valid), as, in fact, fa.parallel() and fa.parallel.poly() functions plot "the eigenvalues for a principal components solution as well as the eigen values when the communalities are estimated by a one factor minres solution for a given data set as well as that of n (default value = 20) randomly generated parallel data sets of the same number of variables and subjects" (Revelle, 2015, p. 175-176) [bold emphasis mine].

UPDATE (based on the OP's clarification of the question):

I think that the double line output on number of factors/components is due to a second call to fa.parallel() or fa.parallel.poly() somewhere, because the standard output from fa.parallel.poly() contains only a single such line. See the MRE below.

Code:

library(psych)

data(bock)

fa.info <- fa.parallel.poly(lsat6)
summary(fa.info)

Output:

 See the graphic output for a description of the results
Parallel analysis suggests that the number of factors =  3  and the number of components =  1

enter image description here

References

Revelle, W. (2015). An introduction to psychometric theory with applications in R. [Website] Retrieved from http://www.personality-project.org/r/book

NOTE: Both my citations can be found in Chapter 6 of the referenced book, directly downloadable from http://www.personality-project.org/r/book/Chapter6.pdf.

Aleksandr Blekh
  • 7,867
  • 2
  • 27
  • 93
  • Thanks @Aleksandr Blekh, I should clarify my question -- there is two line of output, this first line suggest 4 factors and 3 components, but the second line suggest 2 factors and 2 components... I don't understand why there are 2 lines.. :( – ceoec Apr 05 '15 at 22:05
  • @ceoec: Which two lines are you talking about: marked by crosses and triangles OR one of those and red-colored one? – Aleksandr Blekh Apr 05 '15 at 22:25
  • oh I know where the confusion lies now -- the line refer to the output of the text, not in the graph. – ceoec Apr 05 '15 at 22:37
  • @ceoec: Thank you for clarification. Please see the UPDATE section in my answer. – Aleksandr Blekh Apr 06 '15 at 01:24
  • Thanks! I also thought about the second call, but if that's really a second call to fa.parallel.poly, the results should be the same.... and I checked by running fa.parallel and the result did not match too, so can't explain where that line came from. – ceoec Apr 06 '15 at 06:48
  • 1
    @ceoec: You're welcome. The results might very well be different, either if the function's parameters are different, or if the function is applied to a different object (for example, you may have two correlation matrices in your workspace, etc. - that's why an MRE might be helpful). – Aleksandr Blekh Apr 06 '15 at 06:57
  • if you replace your MRE line "fa.info – ceoec Apr 06 '15 at 07:37
  • @ceoec: True. However, the lines are not different, which is expected. That is not the case in your question's scenario. – Aleksandr Blekh Apr 06 '15 at 07:43
  • The lines are different in my output! orz Let me update that in my question can't paste here... – ceoec Apr 06 '15 at 07:49
  • 2
    @ceoec: I saw your update. This is quite odd. I tested my MRE on [R-Fiddle](http://r-fiddle.org). Therefore, logically, different output of the same code suggests to me that the problem is most likely with your R environment. Try to provide the full MRE or, at least, output of both `sessionInfo()` and `options()`. – Aleksandr Blekh Apr 06 '15 at 08:01
  • Aleksandr Belkh: agree that's likely something with my R environment after looking at the output from R-Fiddle -- the eigne values line wasn't making sense in my output which may suggest some problems too... let me see if the problem still exists after I restart R...(my output of sessionInfo() and options() are crazily long now...) – ceoec Apr 06 '15 at 08:10
  • This is really odd, I reboot my whole machine and start with a fresh R studio environment but I still have that strange results from your MRE :( I added sessionInfo() and options() in my questions but I do not understand them..... – ceoec Apr 06 '15 at 08:40
  • 1
    Anyways huge thanks Aleksandr! With your help I know at least I can trust the first line of output... :) – ceoec Apr 06 '15 at 08:43
  • 1
    @ceoec: You're very welcome! Glad to help. The fact that you've restarted your machine might not alleviate the problem, if it's something that gets loaded automatically in your `R` profiles. I looked at your session information and options - nothing really jumps at me. Hopefully, other people will lend their fresh pairs of eyes (instead of our tired ones :-) and offer some suggestions. – Aleksandr Blekh Apr 06 '15 at 09:33
  • 1
    +1 Fantastic answer! Also great that the question didn't got (unwarrantably) closed as programming question – user603 Apr 06 '15 at 10:23
  • @user603: I greatly appreciate your kind words! – Aleksandr Blekh Apr 06 '15 at 10:28
  • 2
    user603, hope it won't get closed. It didn't appear as programming issue at the beginning... huge thanks to @Aleksandr Blekh for trying this out on R-Fiddle or else I would never thought of that! – ceoec Apr 06 '15 at 13:30