The lavaangui package provides a free, open-source graphical user interface for the lavaan package. The core feature is that models can be specified by drawing path diagrams and fitted models visualized via interactive path diagrams.
There are three main ways to use the lavaangui package.
-
Web application: The easiest is to visit https://lavaangui.org/ and use it as a web application. This requires no additional software besides a web browser. The main downside of this is that the webserver is likely slower than your computer. So, fitting complicated models might take a long time. The app is likely also more responsive on your computer.
-
Local web application: After installing the
lavaanguipackage (see below), you can start a local version of the web application via thelavaangui()command. -
Interactive plots:
lavaanguican also be used for plottinglavaanmodels that were created in R. For this, useplot_lavaan(fit). This will create a path diagram of your model. The core difference compared to other packages for plottinglavaanmodels is that the resulting plot is interactive. That is, you can change its appearance easily, for example, by dragging around nodes with your mouse.
An extensive tutorial on using lavaangui is available at https://www.tandfonline.com/doi/full/10.1080/10705511.2024.2420678.
For the web application, no installation is necessary. Simply go to https://lavaangui.org/. The web application should work with any modern browser. It is continuously being tested with: Chrome, Edge, Safari, Firefox, and Opera.
You can install the latest version of the R package as usual using the following command:
install.packages("lavaangui")
You can start the lavaangui web application by typing
library(lavaangui)
lavaangui()
into your R console.
Alternatively, you can also use the command lavaangui(fit), where fit is any supported fitted lavaan object. This will initialize the web application with the model (and data) contained in fit. For example, the following code initializes the web application with a three factor model.
library(lavaan)
library(lavaangui)
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit <- cfa(HS.model, data = HolzingerSwineford1939)
lavaangui(fit)
To obtain an interactive plot of your fitted model without leaving R Studio, use the plot_lavaan(fit) function:
library(lavaan)
library(lavaangui)
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit <- cfa(HS.model, data = HolzingerSwineford1939)
plot_lavaan(fit)
If you use lavaangui in your research, please cite the following paper:
Karch, J. D. (2025). lavaangui: A Web-Based Graphical Interface for Specifying Lavaan Models by Drawing Path Diagrams. Structural Equation Modeling: A Multidisciplinary Journal, 1-12. https://doi.org/10.1080/10705511.2024.2420678