Is it possible to visualize standardized CFA loadings in R instead of estimated ones?

I’m working with R and the lavaan package for confirmatory factor analysis (CFA). I’ve successfully fitted a CFA model and obtained the standardized loadings in the ‘Std.all’ column of the lavaan output. However, I’m stumped when it comes to plotting these standardized loadings.

# Example code
library(psychometrics)
library(vizfactor)

# Generate sample data
data <- generate_cfa_data(n = 200, factors = 2, items_per_factor = 3)

# Fit CFA model
model <- 'Factor1 =~ Item1 + Item2 + Item3
          Factor2 =~ Item4 + Item5 + Item6'
fit <- run_cfa(data, model)

# Attempt to plot standardized loadings
plot_loadings(fit)

I’ve tried using lavaanPlot and a few other packages, but they all seem to default to plotting the estimated loadings from the ‘Estimate’ column. Is there a way to plot the standardized loadings instead? Any suggestions for packages or methods that could help me visualize the ‘Std.all’ values would be greatly appreciated!

I’ve encountered this issue before when working with lavaan and CFA visualizations. One approach that’s worked well for me is using the ‘semTools’ package in combination with ‘ggplot2’. Here’s a method you might find useful:

library(semTools)
library(ggplot2)

# Extract standardized loadings
std_loadings <- standardizedSolution(fit)

# Filter for just the factor loadings
factor_loadings <- subset(std_loadings, op == '=~')

# Create the plot
ggplot(factor_loadings, aes(x = rhs, y = est.std, fill = lhs)) +
  geom_bar(stat = 'identity', position = 'dodge') +
  coord_flip() +
  labs(x = 'Items', y = 'Standardized Loadings', fill = 'Factors') +
  theme_minimal()

This approach gives you more control over the visualization and ensures you’re working with the standardized loadings. You can further customize the plot to suit your specific needs or presentation style.

Hey there, Mia_79Dance! :man_dancing::dancer:

I totally get your frustration with visualizing those standardized loadings. It’s like trying to teach a cat to swim, right? :sweat_smile:

Have you tried the semPlot package? It’s pretty nifty for this kind of thing. Here’s a little snippet that might help:

library(semPlot)
semPaths(fit, what = "std", layout = "tree", edge.label.cex = 0.8)

This should give you a cool diagram with the standardized loadings. The ‘what = “std”’ part is the secret sauce that tells it to use the standardized values.

But hey, I’m curious - what made you want to visualize the standardized loadings specifically? Are you comparing models or just trying to get a clearer picture of your factor structure? It’d be awesome to hear more about your project!

Oh, and have you explored any ggplot2 solutions? I feel like there might be some creative ways to DIY this if the existing packages aren’t cutting it. What do you think?