Hi All,

I was trying to run Factor analysis for a dataset with around 150 variables but only have around 80 observations.

I tried the "factanal" function in R and R reported error:

Error in solve.default(cv) :

system is computationally singular: reciprocal condition number = 3.0804e-20

Any suggestions on alternative methods / packages?

Here is an example on when would the error occurr:

# This will work (dataset with 80 obs and 15 predictors)

set.seed(1234)

fake_df = as.data.frame(matrix(rnorm(80*15), nrow = 80))

factanal(fake_df, factors = 2, rotation = "varimax")

# This will not (dataset with 80 obs and 150 predictors)

set.seed(1234)

fake_df = as.data.frame(matrix(rnorm(80*150), nrow = 80))

factanal(fake_df, factors = 2, rotation = "varimax")

So far I've replaced the solve function in the "factanal" source code with a numerical solving function one that I created in the attached R-code file using svd, but it did not resolve the issue:

Instead it created new error:

Error in factanal.fit.mle(cv, factors, start[, i], max(cn$lower, 0), cn$opt) :

could not find function "factanal.fit.mle"

More Chenying Gao's questions See All
Similar questions and discussions