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
2
votes
1 answer

Loop over combinations of column names with lavaan syntax

How can I loop over rows of a data frame containing variable names permutations when running a mediation analysis with lavaan? Say I have 4 variables var1, var2, var3, var4: df<- data.frame(var1 = rnorm(100), var2 = rnorm(100), …
blazej
  • 1,678
  • 3
  • 19
  • 41
2
votes
0 answers

Random Intercept Cross Lagged Panel Model (RI-CLPM) in R

I am hoping to run a RI-CLPM in R using three variables. Authors of this paper (Mond & Nestler, 2017) have graciously made the syntax (below) available for two variable model. I'm having some difficulty moving beyond adding 3 additional stability…
ksroogl
  • 249
  • 2
  • 9
2
votes
1 answer

High order interactions in R lavaan

I'm trying to estimate models with three-way interactions in R lavaan using the syntax terms operator : (which works fine with two-way interactions). It seems that lavaan ignores the three-way interaction. To reproduce the problem, one can use…
mcfanda
  • 46
  • 3
2
votes
0 answers

Structural equation modeling / path analysis using lavaan

I'm trying to use the sem function, after having defined a simple model as: Model1 <- 'Y ~ X + M M ~ X' sem (Model1, data = A) Where A is a matrix defined with the command A = matrix(ncol = 3, nrow = 50) A[,1] =…
2
votes
0 answers

R - lavaan - sem - negative variance error

I have set up a model like this: model3<-' # MEASUREMENT union =~ V24 + V25 loyality =~ V52 + V53 + V54 experience =~ V37 + V38 + V39 + V40 # STRUCTURAL union ~ loyality union ~ experience # CORRELATED RESIDUALS V37 ~~ V39 V37 ~~ V38 ' From summary…
Nneka
  • 1,764
  • 2
  • 15
  • 39
2
votes
1 answer

Model identification in lavaan for R

I'm trying to do a latent variable analysis using the package lavaan for R. However, I'm getting the following error messages: Warning messages: 1: In lav_data_full(data = data, group = group, cluster = cluster, : lavaan WARNING: some…
Marco
  • 347
  • 3
  • 18
2
votes
0 answers

Structural Equation Model with Linear Dependency (Lavaan)

I want to estimate a structural equation model using lavaan in R with a categorical mediator. A wrinkle is that three of the exogenous variables are linearly dependent. However, this shouldn't be a problem since I'm using the categorical mediator to…
2
votes
1 answer

Why is my modification indices output wrong?

I'm new to R. I've run the following model in lavaan: model.e <-' + PT =~ V1 + V2 + V3 + V4 + V5 + V6 + V7 + EC =~ V8 + V9 + V10 + V11 + V12 + V13 + V14 + PD =~ V15 + V16 + V17 + V18 + V19 + V20 + V21 + PT ~~ 1*PT + EC ~~ 1*EC + PD ~~ 1*PD' > fit.e…
Marishka Usacheva
  • 347
  • 1
  • 3
  • 13
2
votes
1 answer

Extracting Individual trajectories in Lavaan Growth Curve Models

I have successfully modeled longitudinal data from a study using the growth() function in the Lavaan package for R. I cannot find it documented anywhere on how to extract the predicted trajectories for each participant. I can only find the predicted…
2
votes
1 answer

Regression from error term to dependent variable (lavaan)

I want to test a structural equation model (SEM). There are 3 indicators, I1 to I3, that make up a latent construct LC. This construct should explain a dependent variable DV. Now, assume that unique variance of the indicators will contribute…
BurninLeo
  • 4,240
  • 4
  • 39
  • 56
2
votes
2 answers

Lavaan - CFA - categorical variables - the last threshold is strange

I want to perform a multiple group CFA with lavaan in R. I have several categorical variables and some variables contains 11 categories. So these variables will have 10 thresholds. In the results below you can see thatthe 10th threshold is smaller…
Cécile
  • 21
  • 3
2
votes
2 answers

how to extract "chi square for each group:" values from lavaan when using known groups

I want to extract the individual group chi square values from lavaan output that is provided when conducting multiple, known group sem models. Only the total chi square is provided as a fitMeasure, and the chi square values are not treated as…
2
votes
1 answer

Interaction model using lavaan package in R

I want to fit the Kenny and Judd (1984) model below: y = alpha + gamma1 * psi1 + gamma2 * psi2 + gamma3 * psi1 * psi2 + epsilon The variables psi1 and psi2 are latent variables that are not directly observable. Kenny and Judd (1984) considered the…
Günal
  • 751
  • 1
  • 14
  • 29
2
votes
1 answer

lavaan: Define factor by multiple variables as in Mplus

I want to reduce typing-load in lavaan. Imagine that you have 50 manisfest variables: var1, var2, var3, ... var50. In Mplus it is possible to assign a multitude of variables to a factor with the minus '-' sign like this: Factor BY…
Philippe
  • 655
  • 5
  • 7
1
vote
0 answers

Include repeated measures in lavaan mediation model

How can I account for within-subject dependencies in this model? I've got a 2x2-within-subjects design for which I performed an anova and now need to do a mediation analysis. Where does the term for repeated measures…
aesm315
  • 67
  • 4