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

Understanding degrees of freedom in lavaan

lavaan offers the opportunity to constrain parameters across groups. Assume I have two groups in my data. Assume the following model: library(RCurl) library(lavaan) x <-…
histelheim
  • 4,938
  • 6
  • 33
  • 63
9
votes
2 answers

How can I extract factor loadings from lavaan?

How can I get a table with all of the latent factors and the loading of each measurement item on all factors? I can't seem to find a way to pull this out of a fit lavaan model. Here is the general code I'm using to generate the model…
Jim
  • 11,229
  • 20
  • 79
  • 114
6
votes
0 answers

Compute effect sizes of path coefficients in SEM with R

I am currently using the lavaan package in R for structural equation models. I would like to compute the effect sizes (i.e., partial-eta-squared) for each of my path coefficient. Is there already a package that does this? For instance, how can I…
mat
  • 2,412
  • 5
  • 31
  • 69
6
votes
1 answer

Running a power analysis on a lavaan latent growth curve model

I am trying to conduct a power analysis using semTools on a latent growth curve model estimated using lavaan. See below: library(RCurl) library(lavaan) library(semTools) x <-…
histelheim
  • 4,938
  • 6
  • 33
  • 63
6
votes
1 answer

R Lavaan coding latent variable interactions

Can anyone show me how to code latent variable interactions in the model statement for lavaan package for structural equation models? Suppose I had latent variable L1 and some observed variable F1 and would like to code their interaction effect on…
user3773375
  • 61
  • 1
  • 4
5
votes
0 answers

Predict dependent/endogenous variables from new dataset using lavaan path model in R

I have constructed a path model with the R package lavaan (regressions only, no latent variables) using a complete dataset (data1) with values for all variables (x's and y's). The R code I used is as follows: Specification: model1 <- 'y1 ~ x1 + x2 +…
L. Aguilar
  • 51
  • 1
5
votes
1 answer

lavaan longitudinal invariance CFA with a 2-factor model in R

I use the longInvariance function to asssess longitudinal invariance between two time points for interval data; and I am wondering how the correct lavaan/semTools R-code should look like. It works when I look at one factor at a time; but it…
Oscar Kjell
  • 1,599
  • 10
  • 32
5
votes
2 answers

How to specify correlation between latent and observed variable in lavaan?

I would like to calculate the correlation between latent and observed variables using lavaan in R. Here's a simple example of what I'm trying to do. We have some data and a lavaan model. data(bfi) names(bfi) <- tolower(names(bfi)) mod <- " agree…
Jeromy Anglim
  • 33,939
  • 30
  • 115
  • 173
4
votes
2 answers

How can I display only significant path lines on a path diagram? [R: lavaan, semPlot]

I would like to make changes to my path diagram that I made with the lavaan and semPlot packages. require(lavaan); require(semPlot) head(mtcars) model <-' mpg ~ hp + gear + cyl hp ~ cyl + disp ' fit <- sem(model, "std", data = mtcars) semPaths(fit,…
user8460166
  • 73
  • 1
  • 6
  • 24
4
votes
3 answers

Omit covariance path in sempaths (package: semplot)

I'm having trouble getting rid of a path when I plot an SEM model using sempaths (package semplots). The path looks to be a covariance between two observed variables (V1_1 and V1_2). Here is my code for both the model and output plot: #specifying…
TDUNN
  • 63
  • 1
  • 7
4
votes
2 answers

CFA in R (lavaan) with ordinal data - polychoric correlation included?

I would like to compute a confirmatory factor analysis (CFA) with ordinal data in R using lavaan. The data is from a questionnaire, containing 16 items structured on a Likert-scale. I assume a 4-factor-model to be the best fit to my data. To…
user6899059
3
votes
2 answers

R Lavaan package ERROR: some latent variable names collide with observed variable names

I try without success to run a confirmatory factor analysis (cfa) with R using the Lavaan package. When I fit the model, I always receive this message: Error in lavaan::lavaan(model = cfa1, data = data_study1, model.type = "cfa", : lavaan…
3
votes
2 answers

Path diagram in r

I am trying to plot a path diagram of a Structural Equation Model(SEM) in R. I was able to plot it using semPlot::semPaths(). The output is similar to The SEM was modeled using lavaan package. I want a plot similar to . with estimates and p values.…
Stat009
  • 45
  • 1
  • 5
3
votes
1 answer

Save DiagrammeR object to PNG on disc

I am using the lavaanPlot-Package to plot my Path Model created with lavaan. Works like a charm. Just to make it easier here is a reproducible example Reproducible Example library(pacman) p_unload() p_load(dplyr,lavaan,webshot,lavaanPlot) model <-…
Björn
  • 1,610
  • 2
  • 17
  • 37
3
votes
1 answer

lavaan error - no standard errors computed - R

I have created a questionnaire. This questionnaire is composed of four sub-scales measuring 4 different components of my variable of interest. Each subscale is composed of 3 items. Each item is a 6-point scale (then responses for each item are…
Lea_c
  • 41
  • 3
1
2 3
20 21