I can no longer find the RMSEA of a factor or PCA analysis in R. See this code:
library(psych)
data("Thurstone")
Thurstone
mod1<-pca(Thurstone, nfactors=2)
mod1$RMSEA
factor.stats(Thurstone, mod1)
Where is this information stored? I used to be able to run mod1$RMSEA
and get it quite cleanly.
After reading the help page for factor.stats
I suggest
factor.stats(Thurstone, mod1)$RSMEA
So what you may have done before was something like
Fstats <- factor.stats(Thurstone, mod1)
Fstats$RMSEA
There’s another function, principal
in pkg::psych that sometimes gets different results but I don’t know if the difference includes the RMSEA values.
Once I was able to do some hacking on something other than my iPhone I found that including the n.obs argument seems to solve the problem:
factor.stats(Thurstone, mod1, n.obs=500)$RMSEA
RMSEA lower upper confidence
0.1789257 0.1622499 0.1965331 0.9000000
Added note: You can see that the help page for ?pca
doesn't actually document the pca
function; rather it describes the principal
function. And if you look at the code for pca
is shows that the "n.obs" needed by factor.stats
is set to NA.
> pca
function (r, nfactors = 1, residuals = FALSE, rotate = "varimax",
n.obs = NA, covar = FALSE, scores = TRUE, missing = FALSE,
impute = "median", oblique.scores = TRUE, method = "regression",
use = "pairwise", cor = "cor", correct = 0.5, weight = NULL,
...)
{
principal(r = r, nfactors = nfactors, residuals = residuals,
rotate = rotate, n.obs = n.obs, covar = covar, scores = scores,
missing = missing, impute = impute, oblique.scores = oblique.scores,
method = method, use = use, cor = cor, correct = 0.5,
weight = NULL, ...)
}
<bytecode: 0x5654e4aea470>
<environment: namespace:psych>
So if principal
had been called everything would have come as expected:
> mod1<-principal(Thurstone, nfactors=2)
> mod1$RMSEA
NULL
> factor.stats(Thurstone, mod1, n.obs=500)$RMSEA
RMSEA lower upper confidence
0.1789257 0.1622499 0.1965331 0.9000000