How to ask lavaanPlot to show the error terms variances for both observed and latent factor

34 views Asked by At

I am trying to modify the code below such that the plot shows the error term variances for both observed and latent variables. Does lavaanPlot provide such an option?

    # Load libraries:
library(dplyr)
library(lavaan)

# Create variables:
var1 <- 
  rnorm(10, 5, 1)

var2 <- 
  rnorm(10, 5, 1)

var3 <- 
  rnorm(10, 5, 1)

# Create dataframe:
df <-
  tibble(var1, var2, var3)

# Define CFA model:
latent_var <-
  "latent_var =~ var1 + var2 + var3"

# Fit CFA model, ignoring warnings:
cfa_mod <-
  cfa(latent_var, df)

# Summarise, specifying standardised factor loadings:
summary(cfa_mod, standardized = TRUE)

# Load libraries:
library(lavaanPlot)

# Plot model, specifying coefficient labels
lavaanPlot(model = cfa_mod, node_options = list(shape = "box", fontname = "Helvetica", fontsize=18), edge_options = list(color = "black"), coefs = TRUE, covs = TRUE, stand = TRUE, graph_options = list(rankdir = "RL"))
0

There are 0 answers