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

AVE and Omega values for higher order factors (lavaan and semTools)

I want to use the reliability() function from package semToolson the output from sem() (package lavaan). I'm using the function like this: reliability(fit, return.total = TRUE, dropSingle = FALSE, omit.imps = c("no.conv", "no.se")) But I'm getting…
User_4373
  • 379
  • 1
  • 3
  • 17
1
vote
0 answers

lavaan ERROR: model is a list, but not a parameterTable? in lavaan, Rstudio

What I'm doing I'm trying to do Structural Equation Model(cross-lagged effect model) with panel data. My code model_jes3 <- ' #latent:internal, institution observed:INFLU, COMPLEX, PARTY, ELECTION, CONGRESS internal1 =~ 1*INFLU1 +…
Ashu
  • 111
  • 5
1
vote
0 answers

Infinite or missing values in 'x' lavaan error

I am sure I am missing something obvious but this is my first time using SEM outside of stats class. The big picture is that I'm trying to model a multivariate moderated mediation analysis and wasn't having issues until this morning when I started…
1
vote
0 answers

Is it possible to fix parameters in a lavaan model directly with values from a vector?

I am currently trying to cross-validate regression coefficients in a regularized structural equation model (s. Jacobucci, Grimm & McArdle, 2016). For this i'd like to first estimate the model in a training data set in order to then fix the…
1
vote
1 answer

Issue building a function using Lavaan syntax

I am trying to write a very simple function for my use of lavaan in order to obtain an effect from a very simple model. The code is below: library(lavaan) states <- as.data.frame(state.x77) Effect<-function(dataset, X1, Y) { Model<-' X1 ~~ X1; Y…
1
vote
0 answers

R: install.packages("semPlot") does not seem to work

I've been trying to use LAVAAN, which means I need to set up "semPlot" first. However when I try install.packages("semPlot") I receive this message: Warning in install.packages : dependency ‘XML’ is not available also installing the dependencies…
1
vote
0 answers

Using getCov in R lavaan with an actual, large correlation matrix

I’m looking to use lavaan confirmatory factor analysis (CFA) functionality with 120 indicators (variables) and about 400k respondents. This large sample size is causing memory issues in R. Usually I might just use a smaller batch of people, but I’m…
Drew10
  • 11
  • 2
1
vote
1 answer

Model Syntax for Simple Moderation Model in Lavaan (with bootstrapping)

I am a social scientist currently running a simple moderation model in R, in the form of y ~ x + m + m * x. My moderator is a binary categorical variable (two separate groups). I started out with lm(), bootstrapped estimates with boot() and…
AleKir
  • 11
  • 1
  • 2
1
vote
1 answer

CFA model with intentional cross-loadings does not converge in lavaan

I’m trying to run a confirmatory factor analysis in lavaan on a questionnaire scale of Social Dominance Orientation (SDO), replicating past research done in the development of the scale. However, the model doesn’t converge, and I don’t know why. It…
1
vote
0 answers

Why is lavaan doing list wise deletion when specifying missing="film"?

A lot of my colleagues use FIML in Mplus to address missing data, I'm working on a method comparison study to illustrate some of the advantages/disadvantages of using FIML vs other imputation approaches. All my analysis is done in R so I was hoping…
May
  • 21
  • 2
1
vote
1 answer

What is the next step to do after calculating factor loadings in Structural Equation Modelling? And Do Latent Variables have R2?

I am still a beginner in SEM though I know how to write the basic script for SEM in Lavaan R. Background on the data: It's a survey with 308 observations, 2 variables with a scale from 1 to 10, and 10 more with a scale from 1 to 5. I defined my…
1
vote
0 answers

Why lavaan does not work with ordinal endogenous variables

I am working on survey data and try to analyse it with SEM in R with lavaan The data has no missing value, and there are 1723 cases. My model has 2 factors and two ordinal endogenous variables. And the model looks like below: #model1 model1 <- ' …
1
vote
3 answers

How do I include p-value and R-square for the estimates in semPaths?

I am using semPaths (semPlot package) to draw my structural equation models. After some trial and error, I have a pretty good script to show what I want. Except, I haven’t been able to figure out how to include the p-value/significance levels of the…
Louise M
  • 53
  • 1
  • 6
1
vote
1 answer

how test the difference in factor loadings of latent variable using lavaan package in R

How can I calculate the estimate of factor loading for latent variables between different data frames? I have 3 data frames related to 1 latent variable (the same variables A B C D) but in different intervals. dataframe1 (100-120 days). (1550…
BD'auria
  • 135
  • 10
1
vote
0 answers

How do I add control variables when doing SEM in lavaan R?

I was wondering if there is a function to add control variables when doing SEM in lavaan conveniently in R? I would like to test the mediation effect of WE between OSE and IWB. However, if there is another variable Z (e.g. age or gender) that…
Deep Learning
  • 21
  • 1
  • 4