C_H
C_H

Reputation: 191

mixedCor: Misidentification of categorical data for PCA?

I am running a series of principal components analyses using the psych package in R. I have a mix of continuous (read discrete), binary, and ordinal variables. See below for a subset of the data comprising 10 continuous (read discrete) variables (c1 to c10) and one dichotomous variable (d):

dput(s)
structure(c(21, 0, 0, 6, 3, 18, 15, 0, 18, 0, 12, 13, 3, 3, 0, 
21, 6, 0, 0, 12, 12, 11, 0, 0, 12, 0, 0, 0, 21, 10, 0, 0, 0, 
0, 4, 0, 3, 30, 8, 12, 0, 0, 0, 0, 0, 0, 9, 0, 7, 15, 0, 11, 
0, 0, 24, 0, 22, 0, 21, 0, 15, 12, 0, 0, 0, 0, 0, 18, 17, 4, 
0, 26, 13, 0, 0, 12, 17, 0, 0, 0, 0, 22, 0, 0, 0, 0, 3, 0, 0, 
21, 11, 8, 30, 22, 11, 18, 0, 5, 6, 0, 6, 0, 0, 15, 0, 18, 0, 
24, 6, 18, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 9, 5, 15, 3, 15, 19, 
20, 15, 27, 12, 0, 0, 0, 22, 0, 0, 12, 18, 22, 0, 15, 8, 18, 
5, 11, 0, 9, 0, 0, 0, 5, 0, 6, 0, 21, 19, 11, 12, 24, 5, 6, 0, 
0, 4, 0, 0, 0, 3, 3, 0, 0, 4, 5, 0, 29, 3, 21, 5, 5, 8, 18, 0, 
0, 0, 0, 0, 6, 27, 24, 0, 3, 12, 3, 0, 3, 0, 0, 8, 0, 0, 5, 3, 
0, 0, 10, 3, 5, 4, 4, 0, 4, 9, 12, 6, 0, 5, 3, 4, 3, 8, 25, 3, 
0, 0, 10, 13, 3, 4, 21, 6, 0, 0, 6, 0, 23, 0, 5, 6, 9, 9, 0, 
6, 0, 4, 3, 7, 7, 29, 8, 0, 21, 9, 0, 5, 5, 0, 9, 0, 11, 11, 
3, 7, 0, 11, 14, 3, 4, 6, 10, 4, 0, 17, 11, 3, 0, 3, 3, 0, 7, 
3, 0, 4, 5, 4, 0, 0, 6, 3, 0, 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, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, NA, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), .Dim = c(200L, 
11L), .Dimnames = list(c("1", "2", "3", "4", "5", "6", "7", "8", 
"9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", 
"20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", 
"31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", 
"42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", 
"53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63", 
"64", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", 
"75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", 
"86", "87", "88", "89", "90", "91", "92", "93", "94", "95", "96", 
"97", "98", "99", "100", "101", "102", "103", "104", "105", "106", 
"107", "108", "109", "110", "111", "112", "113", "114", "115", 
"116", "117", "118", "119", "120", "121", "122", "123", "124", 
"125", "126", "127", "128", "129", "130", "131", "132", "133", 
"134", "135", "136", "137", "138", "139", "140", "141", "142", 
"143", "144", "145", "146", "147", "148", "149", "150", "151", 
"152", "153", "154", "155", "156", "157", "158", "159", "160", 
"161", "162", "163", "164", "165", "166", "167", "168", "169", 
"170", "171", "172", "173", "174", "175", "176", "177", "178", 
"179", "180", "181", "182", "183", "184", "185", "186", "187", 
"188", "189", "190", "191", "192", "193", "194", "195", "196", 
"197", "198", "199", "200"), c("c1", "c2", "c3", "c4", "c5", 
"c6", "c7", "c8", "c9", "c10", "d")))

Running:

pca <- principal(s, nfactors = 11, rotate = "none", cor = "mixed"

should compute a heterogeneous correlation matrix; however, the code throws an error, in which it seems to be misidentifying the dichotomous variable (d) as a polytomous variable:

Some polytomous variables have fewer categories than they should. Please check your data. Potential bad items are Error in mixedCor(r, use = use, correct = correct) : I am stopping because of the problem with polytomous data

Why is the variable being misidentified and how do I rectify the issue?

Upvotes: 2

Views: 701

Answers (1)

Chuck P
Chuck P

Reputation: 3923

I'm worried you're missing too much data across the correlation matrix, but if you're sure it's misidentification try this...

library(psych)

# Make variable types explicit...

new_s <- mixedCor(s, c=c("c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10"), d = "d")

#> Warning in biserialc(x[, j], y[, i], j, i): For x = 7 y = 1 x seems to be
#> dichotomous, not continuous
#> Warning in biserialc(x[, j], y[, i], j, i): For x = 9 y = 1 x seems to be
#> dichotomous, not continuous
#> Warning in biserialc(x[, j], y[, i], j, i): For x = 10 y = 1 x seems to be
#> dichotomous, not continuous

# Feed this new matrix to PCA

principal(new_s$rho, nfactors = 11, rotate = "none", cor = "mixed")
#> Warning in cor.smooth(model): Matrix was not positive definite, smoothing was
#> done
#> Warning in cor.smooth(r): Matrix was not positive definite, smoothing was done
#> Warning in log(det(m.inv.r)): NaNs produced
#> Principal Components Analysis
#> Call: principal(r = new_s$rho, nfactors = 11, rotate = "none", cor = "mixed")
#> Standardized loadings (pattern matrix) based upon correlation matrix
#>      PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8   PC9  PC10 PC11  h2
#> c1  0.45  0.39  0.64 -0.05  0.30 -0.09 -0.10 -0.33  0.12  0.06    0 1.0
#> c2  0.46  0.47  0.23  0.62 -0.11 -0.12 -0.24  0.20 -0.06  0.00    0 1.0
#> c3  0.55  0.31  0.52 -0.48 -0.04  0.03  0.07  0.27 -0.12 -0.08    0 1.0
#> c4  0.33  0.68 -0.38  0.01  0.22  0.44  0.17  0.02 -0.05  0.16    0 1.0
#> c5  0.56  0.29 -0.07 -0.10 -0.73  0.01  0.08 -0.12  0.16  0.04    0 1.0
#> c6  0.73  0.27 -0.44  0.00  0.23 -0.13  0.08  0.04  0.22 -0.29    0 1.0
#> c7  0.85 -0.19 -0.14  0.06 -0.09  0.24 -0.18 -0.23 -0.27 -0.15    0 1.0
#> c8  0.71  0.06 -0.39 -0.09  0.07 -0.52  0.12 -0.03 -0.17  0.17    0 1.0
#> c9  0.65 -0.44  0.29  0.34  0.04  0.13  0.46  0.04  0.08  0.04    0 1.0
#> c10 0.77 -0.36 -0.17 -0.13  0.09  0.14 -0.39  0.14  0.20  0.16    0 1.0
#> d   1.01 -0.46  0.14 -0.05  0.04  0.00  0.03  0.03 -0.05  0.01    0 1.3
#>           u2 com
#> c1  -2.9e-04 4.0
#> c2  -1.2e-03 4.0
#> c3  -1.5e-02 4.3
#> c4  -9.2e-03 3.5
#> c5  -8.2e-04 2.5
#> c6  -5.1e-05 3.0
#> c7  -2.9e-02 2.0
#> c8  -1.3e-02 2.9
#> c9  -4.9e-02 4.0
#> c10 -3.1e-02 2.7
#> d   -2.6e-01 1.5
#> 
#>                        PC1  PC2  PC3  PC4  PC5  PC6  PC7  PC8  PC9 PC10 PC11
#> SS loadings           4.91 1.67 1.38 0.78 0.77 0.60 0.52 0.31 0.26 0.20 0.00
#> Proportion Var        0.45 0.15 0.13 0.07 0.07 0.05 0.05 0.03 0.02 0.02 0.00
#> Cumulative Var        0.45 0.60 0.72 0.80 0.86 0.92 0.97 0.99 1.02 1.04 1.04
#> Proportion Explained  0.43 0.15 0.12 0.07 0.07 0.05 0.05 0.03 0.02 0.02 0.00
#> Cumulative Proportion 0.43 0.58 0.70 0.77 0.83 0.89 0.93 0.96 0.98 1.00 1.00
#> 
#> Mean item complexity =  3.1
#> Test of the hypothesis that 11 components are sufficient.
#> 
#> The root mean square of the residuals (RMSR) is  0.03 
#> 
#> Fit based upon off diagonal values = 1

You can only also run a PCA on this data if you move to pairwise which means you can't also have mixed

library(psych)
s <- 

cor(s)
#>            c1        c2 c3 c4 c5        c6 c7 c8        c9       c10  d
#> c1  1.0000000 0.4346003 NA NA NA 0.2240019 NA NA 0.2394707 0.1374522 NA
#> c2  0.4346003 1.0000000 NA NA NA 0.3264929 NA NA 0.2507157 0.1502570 NA
#> c3         NA        NA  1 NA NA        NA NA NA        NA        NA NA
#> c4         NA        NA NA  1 NA        NA NA NA        NA        NA NA
#> c5         NA        NA NA NA  1        NA NA NA        NA        NA NA
#> c6  0.2240019 0.3264929 NA NA NA 1.0000000 NA NA 0.2630730 0.5129754 NA
#> c7         NA        NA NA NA NA        NA  1 NA        NA        NA NA
#> c8         NA        NA NA NA NA        NA NA  1        NA        NA NA
#> c9  0.2394707 0.2507157 NA NA NA 0.2630730 NA NA 1.0000000 0.3958641 NA
#> c10 0.1374522 0.1502570 NA NA NA 0.5129754 NA NA 0.3958641 1.0000000 NA
#> d          NA        NA NA NA NA        NA NA NA        NA        NA  1
cor(s, use = "pairwise")
#>            c1         c2        c3          c4        c5        c6        c7
#> c1  1.0000000 0.43460033 0.5944554  0.17820073 0.1585417 0.2240019 0.2133379
#> c2  0.4346003 1.00000000 0.2721470  0.27657740 0.3458928 0.3264929 0.3064696
#> c3  0.5944554 0.27214700 1.0000000  0.22051983 0.3980126 0.2540505 0.2620851
#> c4  0.1782007 0.27657740 0.2205198  1.00000000 0.2582113 0.5332303 0.2655366
#> c5  0.1585417 0.34589275 0.3980126  0.25821130 1.0000000 0.3704633 0.4592527
#> c6  0.2240019 0.32649293 0.2540505  0.53323028 0.3704633 1.0000000 0.5407480
#> c7  0.2133379 0.30646960 0.2620851  0.26553664 0.4592527 0.5407480 1.0000000
#> c8  0.1518731 0.24817433 0.2186919  0.27508923 0.3883494 0.7126438 0.4923743
#> c9  0.2394707 0.25071568 0.2046642 -0.03278746 0.2041263 0.2630730 0.4815600
#> c10 0.1374522 0.15025695 0.2323497  0.11446032 0.2827706 0.5129754 0.6897342
#> d   0.1410538 0.08626762 0.2042181 -0.02416854 0.1309677 0.2039654 0.4720930
#>            c8          c9       c10           d
#> c1  0.1518731  0.23947075 0.1374522  0.14105375
#> c2  0.2481743  0.25071568 0.1502570  0.08626762
#> c3  0.2186919  0.20466424 0.2323497  0.20421810
#> c4  0.2750892 -0.03278746 0.1144603 -0.02416854
#> c5  0.3883494  0.20412633 0.2827706  0.13096770
#> c6  0.7126438  0.26307300 0.5129754  0.20396537
#> c7  0.4923743  0.48155995 0.6897342  0.47209296
#> c8  1.0000000  0.24786725 0.4538082  0.24682472
#> c9  0.2478672  1.00000000 0.3958641  0.48647659
#> c10 0.4538082  0.39586413 1.0000000  0.47158572
#> d   0.2468247  0.48647659 0.4715857  1.00000000
pca <- principal(s, nfactors = 11, rotate = "none", use = "pairwise")
pca
#> Principal Components Analysis
#> Call: principal(r = s, nfactors = 11, rotate = "none", use = "pairwise")
#> Standardized loadings (pattern matrix) based upon correlation matrix
#>      PC1   PC2   PC3   PC4   PC5   PC6   PC7   PC8   PC9  PC10  PC11 h2
#> c1  0.47  0.44  0.59  0.22  0.19 -0.17 -0.09 -0.05 -0.30  0.15  0.04  1
#> c2  0.52  0.41  0.20  0.24 -0.59 -0.04 -0.19  0.22  0.17 -0.05  0.00  1
#> c3  0.54  0.39  0.46 -0.29  0.39  0.01  0.07 -0.02  0.26 -0.18 -0.05  1
#> c4  0.44  0.50 -0.42  0.26  0.14  0.50  0.11 -0.05  0.00 -0.01  0.15  1
#> c5  0.60  0.21 -0.08 -0.67 -0.28  0.11  0.09  0.02 -0.10  0.18  0.02  1
#> c6  0.77  0.11 -0.44  0.19  0.11 -0.15  0.08 -0.05  0.07  0.16 -0.30  1
#> c7  0.81 -0.28 -0.08 -0.06 -0.07  0.15 -0.23 -0.12 -0.25 -0.29 -0.11  1
#> c8  0.70 -0.03 -0.39 -0.01  0.07 -0.47  0.21  0.16 -0.06 -0.14  0.19  1
#> c9  0.56 -0.41  0.37  0.17 -0.27  0.03  0.37 -0.37  0.07  0.02  0.05  1
#> c10 0.71 -0.43 -0.09 -0.03  0.16 -0.03 -0.43 -0.12  0.18  0.16  0.15  1
#> d   0.51 -0.56  0.29  0.09  0.14  0.25  0.14  0.47 -0.03  0.07 -0.03  1
#>           u2 com
#> c1  -1.1e-15 4.6
#> c2  -4.4e-15 4.3
#> c3  -3.6e-15 5.3
#> c4   3.4e-15 5.0
#> c5   6.0e-15 3.0
#> c6   2.4e-15 2.5
#> c7   1.9e-15 2.2
#> c8   1.3e-15 3.1
#> c9  -4.4e-16 5.3
#> c10  1.0e-15 3.1
#> d    2.3e-15 4.4
#> 
#>                        PC1  PC2  PC3  PC4  PC5  PC6  PC7  PC8  PC9 PC10 PC11
#> SS loadings           4.15 1.58 1.36 0.78 0.77 0.63 0.52 0.47 0.31 0.25 0.19
#> Proportion Var        0.38 0.14 0.12 0.07 0.07 0.06 0.05 0.04 0.03 0.02 0.02
#> Cumulative Var        0.38 0.52 0.64 0.71 0.79 0.84 0.89 0.93 0.96 0.98 1.00
#> Proportion Explained  0.38 0.14 0.12 0.07 0.07 0.06 0.05 0.04 0.03 0.02 0.02
#> Cumulative Proportion 0.38 0.52 0.64 0.71 0.79 0.84 0.89 0.93 0.96 0.98 1.00
#> 
#> Mean item complexity =  3.9
#> Test of the hypothesis that 11 components are sufficient.
#> 
#> The root mean square of the residuals (RMSR) is  0 
#>  with the empirical chi square  0  with prob <  NA 
#> 
#> Fit based upon off diagonal values = 1
principal(s, nfactors = 11, rotate = "none", use = "pairwise", cor = "mixed")
#> 
#>  Some polytomous variables have fewer categories than they should.  Please check your data.  
#> Potential bad items are
#> Error in mixedCor(r, use = use, correct = correct): 
#> I am stopping because of the problem with polytomous data

Upvotes: 2

Related Questions