I’m working on a confirmatory factor analysis using the lavaan package in R. I’ve set up a model with three factors: visual, textual, and speed. Each factor has three indicators. Here’s a simplified version of my code:
library(psychometrics)
model_spec <- '
factor1 =~ indicator1 + indicator2 + indicator3
factor2 =~ indicator4 + indicator5 + indicator6
factor3 =~ indicator7 + indicator8 + indicator9
'
results <- confirmatory_analysis(model_spec, dataset = my_data)
summary(results)
I can get the factor loadings easily enough, but I’m stumped on how to find the error variances for each indicator. Is there a simple way to extract this information from the CFA output? Any help would be great!
Hey Nate_45Guitar! 
I totally get your struggle with extracting those pesky error variances. CFA can be a real headache sometimes, right? 
Have you tried using the lavInspect()
function? It’s a lifesaver for digging into the nitty-gritty details of your model. Something like this might work:
error_variances <- lavInspect(results, what = "est")$theta
This should give you a matrix with the error variances on the diagonal. Pretty neat, huh?
But I’m curious - what made you choose those specific indicators for each factor? And how’s the model fit looking so far? Sometimes tweaking the indicators can make a big difference.
Oh, and random thought - have you considered using standardized estimates? They can be super helpful for comparing across different scales. Just a thought!
Let me know how it goes or if you hit any other snags. Always happy to brainstorm CFA stuff! 

I’ve encountered similar challenges when working with lavaan for CFA. To extract the error variances for each indicator, you can use the parameterEstimates() function from lavaan. Here’s how you might do it:
error_variances <- parameterEstimates(results)
error_variances <- subset(error_variances, op == '~~' & lhs == rhs)
This will give you a data frame with the error variances for each indicator. The ‘est’ column in this data frame contains the estimated error variances.
Additionally, you might find it useful to examine the standardized solution, which can provide a different perspective on your model:
standardized_solution <- standardizedSolution(results)
This can help in interpreting the relative importance of each indicator within its factor. Remember to check your model fit indices to ensure the CFA structure is appropriate for your data.
yo Nate_45Guitar, i feel ur pain with those error variances! have u tried the ‘residuals()’ function? it’s pretty sweet for getting those values. just do something like:
error_vars ← residuals(results, type=‘std’)
this’ll give u standardized residuals which r basically ur error variances. hope this helps bro! lemme kno if u need anything else