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
3
votes
2 answers

lavaan WARNING: some observed variances are (at least) a factor 1000 times larger than others; use varTable(fit) to investigate

I am trying to evaluate the sem model from a dataset, some of the data are in likert scale i.e from 1-5. and some of the data are COUNTS generated from the computer log for some of the activity. Whereas while performing the fits the laveen is giving…
Rasik
  • 1,961
  • 3
  • 35
  • 72
3
votes
0 answers

Error in eigen(S, symmetric = TRUE) : infinite or missing values in 'x'

I am attempting to run a Confirmatory Factor Analysis in R using lavaan, but I keep getting this error: Error in eigen(S, symmetric = TRUE) : infinite or missing values in 'x' I've checked the data for empty variables or variables with no…
3
votes
2 answers

Error in getMethod("summary", signature = "FitDiff")

I am comparing lavaan objects using semTools::compareFit. It is throwing a very strange error message. I tried also the following reproducible example: data("HolzingerSwineford1939",package="lavaan") HS.modelA <- ' visual =~ x1 + x2 + x3 …
hamagust
  • 728
  • 2
  • 10
  • 28
3
votes
1 answer

Mediated Moderation Model in R (Lavaan)

Suppose you have an outcome variable (Y; continuous), an independent variable (X; dummy), and a moderator (W; dummy). Suppose that you would like to test whether another variable (M; continuous) mediates the link between X and W. How would you go…
Max Hackert
  • 131
  • 1
  • 4
3
votes
1 answer

Effects coding for categorical variables with interactions in lavaan?

I am interested in translating lm-syntax to lavaan, particularly I am after an effects-coded interaction between a factor x numeric variable when the factor has > 2 levels. (Reminder: effects-coding is an alternative to dummy-coding categorical…
JBJ
  • 866
  • 9
  • 21
3
votes
1 answer

Warning: the optimizer warns that a solution has NOT been found

My SEM model seems ok but when trying to fit groups to apply multi-group analysis R shouts the re warning. This is my model (data will follow): model <- ' sndPre =~ R + int + rldct dtls ~ d*open + e*supp open ~ c*gta gta ~ b*sndPre …
Uri
  • 67
  • 1
  • 7
3
votes
1 answer

specify CFA with turbulances being the sum of exogenous correlations

I am trying to specify a curious model in lavaan in R language. The model looks like this: My specification attempt is shown bellow. What I find difficult to achieve is to fix the unique error of the observed variables to be the sum of two…
3
votes
1 answer

semPaths - different size nodes for lavaan SEM

I want to set different sizes for different nodes using semPlot for a SEM model with lavaan. library(lavaan) library(semPlot) model <- ' # measurement model ind60 =~ x1 + x2 + x3 dem60 =~ y1 + y2 + y3 + y4 dem65 =~ y5 + y6 + y7 + y8 …
giac
  • 4,261
  • 5
  • 30
  • 59
3
votes
2 answers

Indirect effects in SEM for slightly complex path model

I wanted to do calculate the direct and all indirect effects for a path analytic model. The path diagram has been given below: I am not sure of the code to use in [R]. There are examples of simple indirect effects and mediation models using…
Piyush Shah
  • 301
  • 4
  • 15
3
votes
0 answers

R (lavaan): How to compare CFA models estimated with DWLS (alias WLSMV)

How can I compare two CFA models estimated with DWLS / WLSMV? To find out which CFA model fits best for my data, I used the DWLS estimator for ordinal data in lavaan and specified two models: 4-factor-model, i.e. model.ordinalX 2-factor-model,…
user6899059
3
votes
1 answer

Lavaan: how to specify interaction terms in SEM

I am using lavaan and have only observed variables (no latent variables). I would like to include an interaction term in the model, but not sure how to do this. This is what I have model4 <-' interac =~ var1 * var2 Ent ~ age presu ~ age +…
user6121484
  • 143
  • 2
  • 15
3
votes
1 answer

Creating lavaan and mirt models permuations of varying size and length

hoping someone can offer some guidance here. I'm creating a multivariate simulation using the simDesign package, I am varying the number of factors as well as items that load on each factor. I would like to write a command that identifies the number…
navac
  • 87
  • 6
3
votes
1 answer

Lavaan CFA vs SEM

I diffed the R lavaan package cfa() and sem() help pages. There are no differences. The code below gives same estimates. If that is the case, what is the point of having two different names to same thing? model <- ' # latent variable…
adam
  • 655
  • 1
  • 10
  • 31
3
votes
1 answer

Setting Covariance to Zero in Lavaan

In lavaan in R, when using the sem() function, the covariance values are automatically populated. However, I want to force one of the covariance values to be zero while using the sem() function, i.e. without moving to the manual lavaan()…
2
votes
1 answer

Plotting a SEM Actor-Partner Interdependence Model after runMI()

I am using multiply-imputed data to run an Actor-Partner Interdependence Model (APIM; Cook & Kenny, 2005). I am using mice to impute my data and for reference, I am using this resource guide for constructing my APIM with lavaan. As far as I can…
jrcalabrese
  • 2,184
  • 3
  • 10
  • 30
1
2
3
20 21