Search code examples
rstat

Is there a function for finding anti imaging correlation matrix in R? I can find it via excel but not in R


Is there a function for finding anti imaging correlation matrix in R? I can find it via excel but not in R. I tried searching for it but couldn't find anything.


Solution

  • Are you trying to calculate the Kaiser-Meyer-Olkin (KMO) index? There is KMO function in the package psych.

    If you review the source code by simply typing psych::KMO, you can see that the function actually calculates the anti imaging correlation matrix and returns it in the value ImgCov. See here about why it's called ImgCov and not ImgCor

    Therefore, you can either calculate KMO index directly, or access the imaging correlation matrix.

    library(psych)
    KMO(Thurstone)$ImCov
                 [,1]        [,2]         [,3]        [,4]         [,5]        [,6]        [,7]        [,8]         [,9]
     [1,]  0.26191905 -0.13247459 -0.098997433  0.01696386 -0.007869000 -0.01530553 -0.02683189 -0.02883750 -0.015467511
     [2,] -0.13247459  0.25042987 -0.093156627 -0.02997555 -0.013462396 -0.03933474 -0.01452050 -0.03244578  0.024857482
     [3,] -0.09899743 -0.09315663  0.325362301 -0.02885198  0.001412136 -0.01360381  0.01550812 -0.06027647 -0.009499454
     [4,]  0.01696386 -0.02997555 -0.028851979  0.44683097 -0.201926848 -0.14992727 -0.02064537  0.01507317 -0.051260798
     [5,] -0.00786900 -0.01346240  0.001412136 -0.20192685  0.479035204 -0.09880388 -0.03070355 -0.01220736 -0.070899784
     [6,] -0.01530553 -0.03933474 -0.013603811 -0.14992727 -0.098803879  0.57375353  0.02729260 -0.00322785 -0.014775752
     [7,] -0.02683189 -0.01452050  0.015508115 -0.02064537 -0.030703553  0.02729260  0.52259809 -0.16114288 -0.222865605
     [8,] -0.02883750 -0.03244578 -0.060276472  0.01507317 -0.012207363 -0.00322785 -0.16114288  0.54993095 -0.065094221
     [9,] -0.01546751  0.02485748 -0.009499454 -0.05126080 -0.070899784 -0.01477575 -0.22286561 -0.06509422  0.571067253