# Coding in R: bart_spher(), KMO(), and eigen(cor()) error

I am performing a factor analysis on a 524 by 211 matrix. I'm using the `bart_spher()`, `KMO()`, and `eigen(cor())` functions before running `factanal()`. My matrix is "doubles" of 1-7 with no NA values.

When I run the three functions on the full matrix, I get the following error:

``````Error in eigen(cor(Factors)) : infinite or missing values in 'x'
1: In cor(Factors) : the standard deviation is zero
2: In cor(x = x, use = use) : the standard deviation is zero
3: In cor(r, use = "pairwise") : the standard deviation is zero
4: In cov2cor(Q) :
diag(.) had 0 or NA entries; non-finite result is doubtful
5: In cor(Factors) : the standard deviation is zero
``````

I also end up getting NA's for the Bartlett and KMO numbers. But there are no infinite or NA values!

If I use only the first 113 columns (a matrix of 524 by 113), then everything works out fine. Is there a column limit I am unaware of for `eigen(cor())`?

That looks like cases where all values in a columns are identical:

``````(X <- matrix(rep(1:3, each=4), nrow = 4, ncol = 3))
#>      [,1] [,2] [,3]
#> [1,]    1    2    3
#> [2,]    1    2    3
#> [3,]    1    2    3
#> [4,]    1    2    3

cor(X)
#> Warning in cor(X): the standard deviation is zero
#>      [,1] [,2] [,3]
#> [1,]    1   NA   NA
#> [2,]   NA    1   NA
#> [3,]   NA   NA    1
``````

Created on 2022-12-01 by the reprex package (v2.0.1)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.