nice_lavaanPlot {lavaanExtra}R Documentation

Make a quick lavaanPlot

Description

Make a quick and decent-looking lavaanPlot.

Usage

nice_lavaanPlot(
  model,
  node_options = list(shape = "box", fontname = "Helvetica"),
  edge_options = c(color = "black"),
  coefs = TRUE,
  stand = TRUE,
  covs = FALSE,
  stars = c("regress", "latent", "covs"),
  sig = 0.05,
  graph_options = c(rankdir = "LR"),
  ...
)

Arguments

model

SEM or CFA model to plot.

node_options

Shape and font name.

edge_options

Colour of edges.

coefs

Logical, whether to plot coefficients. Defaults to TRUE.

stand

Logical, whether to use standardized coefficients. Defaults to TRUE.

covs

Logical, whether to plot covariances. Defaults to FALSE.

stars

Which links to plot significance stars for. One of c("regress", "latent", "covs").

sig

Which significance threshold to use to plot coefficients (defaults to .05). To plot all coefficients, set sig to 1.

graph_options

Read from left to right, rather than from top to bottom.

...

Arguments to be passed to function lavaanPlot::lavaanPlot.

Value

A lavaanPlot, of classes c("grViz", "htmlwidget"), representing the specified lavaan model.

Illustrations

lavaanPlot.png

Examples


x <- paste0("x", 1:9)
(latent <- list(
  visual = x[1:3],
  textual = x[4:6],
  speed = x[7:9]
))

HS.model <- write_lavaan(latent = latent)
cat(HS.model)

library(lavaan)
fit <- cfa(HS.model, HolzingerSwineford1939)
nice_lavaanPlot(fit)


[Package lavaanExtra version 0.2.1 Index]