Questions tagged [r-lavaan]

A free, open-source `R` package for latent variable analysis. `lavaan` includes support for a large variety of multivariate statistical models which contain (or not) latent variables. It allows multilevel analysis, and as estimators that deal with missing values and categorical data. Some of the applications available are confirmatory factor analysis, full structural equation models, latent growth curve models, and path analysis.

A free, open-source R package for latent variable analysis. lavaan includes support for a large variety of multivariate statistical models which contain (or not) latent variables. It allows multilevel analysis, and as estimators that deal with missing values and categorical data. Some of the applications available are confirmatory factor analysis, full structural equation models, latent growth curve models, and path analysis.

Resources

Repositories

Related plotting packages

  • lavaanPlot - Visual analusis of lavaan models.
  • semPlot - visual analysis of various SEM packages' output, including lavaan.
308 questions
1
vote
1 answer

In R, how can I plot the standardised loadings of a CFA model ('Std.all' column in lavaan output) instead of the estimated loadings?

When using the lavaan package in R, I fit a CFA model: # 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,…
dalexco
  • 31
  • 5
1
vote
1 answer

lavaan (SEM) computing standardized coefficients manually

How do I compute the standardized coefficients in the lavaan outputs? This doesn't work for me for some reason. Not for CFA and not for SEM. For CFA, suppose I run the following code: data(HolzingerSwineford1939) dat =…
Maverick Meerkat
  • 5,737
  • 3
  • 47
  • 66
1
vote
1 answer

How do I calculate the omega values for my bifactor model?

I am a psychology graduate student and I am trying to get the required statistics for my bifactor model according to APA. I was able to get the model to converge with some modifications to item loadings (there are 22 items total) using the step by…
1
vote
1 answer

Using probe2WayMC when the dependent variable is binary in lavaan

Is it possible to use the probe2WayMC function of semTools when sem(ordered="dep"), or only when the DV is continuous? I've tried it but I'm receiving this error message: Error in est$beta[nameY, nameX] : subscript out of bounds
1
vote
1 answer

How resp. where do I add interaction terms in my model specification in lavaan?

I'm conducting a mediation analysis for my thesis. The mediation consists of one predictor variable, 4 mediators and three outcomes. After running my model and looking at the significant covariances between the mediators as well as between the…
linduru
  • 11
  • 1
1
vote
2 answers

Group comparisons path-analysis lavaan

I am currently running a serial medaition where my IV is multicategorical with 3 levels, while my moderators and DV are continuous. I created 2 dummy variables for my IV. Therefore in my output I see hwo they compare for different variabels to their…
1
vote
1 answer

Turn off variable abbreviations for lavaan summaries

Is there a way to turn off variable name abbreviations when summarizing model output with lavaan? In the below reprex, you can see that the long variables get automatically shortened. In my real life data, some of my datasets have long variable…
jrcalabrese
  • 2,184
  • 3
  • 10
  • 30
1
vote
0 answers

How do you test the linearity assumption without estimated factor values in SEM models?

Let's say we would work with this simplified path model. lavaan -> ' # measurement model A =~ ItemA + ItemB + ItemC B =~ ItemD + ItemE + ItemF C =~ ItemG + ItemH + ItemI # path model A ~ B + C' How would I then test that B and C do not…
HHKK
  • 21
  • 3
1
vote
0 answers

CFA in R: The variance-covariance matrix of the estimated parameters (vcov) does not appear to be positive definite. What is the problem?

I am trying to calculate a CFA for the Theory of Planned Behaviour (TPB). I have split the 4 factors (Attitude, SubNorm, PBC, Intention) into inverted and non-inverted items. Enclosed is the measurement model. N = 75. The items were rated on a scale…
Paul
  • 11
  • 1
1
vote
1 answer

Difficulties with the ParcelAllocation function

I want to do a structural equation model with several latent variables with item parcels. Some parcels shall be created randomly. I am currently struggling with the "parcelAllocation" function (semTools) and hope that someone can help me out! My…
Chrissie
  • 11
  • 2
1
vote
1 answer

Looking at results by group in multilevel structural equation model using lavaan

I'm trying to do a multilevel structural equation model using a data set with observations from 32 different countries. I cluster the model by country. The model runs but on the output it says there were 29 clusters. Would there be a way to check…
1
vote
0 answers

Remove residual variance paths of y-indicators in sempaths (package: semplot)

I am using the following code semPlot::semPaths to plot a lavaan model: semPaths(object = fit, what = "stand", nCharNodes = 0, layout = "tree", fade = FALSE, exoCov = FALSE, residuals = FALSE, …
1
vote
2 answers

How to tryCatch in R cfa of lavaan library (and inspect errors, but get variable)?

I do simulation research and create different datasets for different CFA models. During a series of simulations, I would like to handle errors resulting from e.g. randomization. Specifically - I would like to be able to repeat the sampling procedure…
kwadratens
  • 187
  • 15
1
vote
0 answers

R: is it possible to draw a diagram with SemPlot without fitting a model?

The documentation for the SemPlot package doesn't appear to show any way to build a path diagram without passing a model object and the model objects appear to only be the output of fit models in e.g. lavaan. Any way to specify nodes and paths…
socialscientist
  • 3,759
  • 5
  • 23
  • 58
1
vote
1 answer

Plot interaction effect in sem model with observed variables in R

I am estimating an SEM model that has observed variables. I am using SEM to handle missing data using FIML. My model has an interaction term to test for moderation. Here is a toy example that illustrates the…
tci
  • 69
  • 7