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

How can I access specific values of a lavaan model by code?

I have to run many CFAs and want to automate saving specific output values in a data frame so I can convert it to a latex table later. Specifically I get my output something like this using lavaan: model <- 'y =~ x1 + x2 + x3' fit <- cfa(model,…
ColdBrew
  • 95
  • 1
  • 7
2
votes
1 answer

Why can't I do a 3 variable CFA with lavaan on R?

Everything works just fine when I have 4 variables or more. But I thought the minimum for a CFA or EFA was 3 variables. When I run the code, it gives me 0's for all the parameters that estimate if it's a good fit or not. For this purpose, i will use…
2
votes
0 answers

Longitudinal Latent Change Score Modeling with Lavaan in R

I have the following data set: structure(list(ID = c(38623L, 38806L, 39593L, 39820L, 39951L, 40286L, 43762L, 52577L, 54153L, 57445L, 58503L, 59344L, 59361L, 60575L, 61656L, 62210L, 62285L, 62937L, 64081L, 64328L, 65302L, 65478L, 65480L, 65487L,…
CanyonView
  • 401
  • 3
  • 15
2
votes
1 answer

Lavaan in R with very small values

I am trying to run a lavaan structural equation model to identify change between two time points. I have the following data set: structure(list(COG_T1 = c(0.0010333, 0.00105981, 0.00113736, 0.001108715, 0.00104864, 0.00110772, 0.00109096,…
CanyonView
  • 401
  • 3
  • 15
2
votes
1 answer

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

I am trying to validate a psychometric using CFA in R, the scale was measure using 5-point likert scale. 6-factor model, 66 items in the model, N = 200. Here is part of my…
ZXX
  • 21
  • 1
  • 3
2
votes
0 answers

lavaan ERROR: missing observed variables in dataset: ..constant

I am using lavaan package to run confirmatory analysis and continue to get the following error Error in lavaan::lavaan(model = model1, data = STR_Historical_Data, model.type = "cfa", : lavaan ERROR: missing observed variables in dataset:…
2
votes
1 answer

How to perform simplest Moderation in lavaan and measuring its effect to other vars?

How to perform simplest Moderation in lavaan and measuring its effect to other vars? You have a model in r, in lavaan - how you add an moderation term?: Does by adding a ~b + c make "c" a moderator term? What is the difference between interaction…
Estatistics
  • 874
  • 9
  • 24
2
votes
1 answer

SEM model with multiple mediators and multiple independent variables in lavaan

I have cross-sectional data and I am trying to specify a model with multiple mediations. My independent variable (IV) is measured by a tool with 24 items, which make up 5 subscales (latent variables), which in turn load onto a total "higher-order"…
2
votes
0 answers

lavaan interaction regression model: sample covariance matrix is not positive-definite

I am running a model with the lavaan R package that predicts a continuous outcome by a continuous and two categorical codes. One of them is a dichotomous variable (let's call it A; 0 = no, 1 = yes) and the other is a three-level categorical variable…
ELdeM
  • 43
  • 4
2
votes
1 answer

Estimating the Variance Inflation Factors (VIF) of a SEM model (lavaan)

I am trying to find the Variance inflation factor (VIF) from a Structural Equation Model (SEM). My model is: # load the data library(readxl) Log_And_SurveyResult <- read_excel("C:/Users/Aakash/Desktop/analysis/Today/Mot-Log.xlsx") # load…
User_4373
  • 379
  • 1
  • 3
  • 17
2
votes
1 answer

Lavaan implausible matrices reported using inspect()

For didactic purposes, I am simulating data consistent with a fixed effects model and then running the model in SEM using lavaan. I don't understand what is going on with the underlying matrices lavaan is giving me using the inspect() function.…
hendogg87
  • 145
  • 1
  • 5
2
votes
1 answer

How adjust a moderated moderated mediation model with processR package?

I want adjust a moderated moderated mediation model with lavaan and processR packages. The model is follow: I tried to create the following moderations: Innovativeness:Age and PBC:Innovativeness:Age My data (df): df <- structure(list(Attitude =…
neves
  • 796
  • 2
  • 10
  • 36
2
votes
1 answer

Error in lav_data "missing observed variables in dataset: " when run CFA

I am running a CFA with the lavaan package in R, but get this error message, saying that some observed variables are missing: Error in lav_data_full(data = data, group = group, cluster = cluster, : lavaan ERROR: missing observed variables in…
shuying
  • 21
  • 1
  • 2
2
votes
2 answers

lavaan package - testing a perfect model is somehow bringing up RMSEA = 0.77

I'm looking at factor models of a 75 question questionnaire. Before I test my models I thought I'd just test a perfect model, a single-factor model including all 75 questions. I thought that this should explain all the variance in the data and that…
T August
  • 21
  • 2
2
votes
2 answers

R loop for several dataframes using Lavaan

I'm currently working on data with 8 waves, each wave is for now stored in it's own dataframe. I've done most of the data cleaning with a lot of repetition, since I couldn't figure out how to make R run the same script over different dataframes. Now…
Eva Billen
  • 21
  • 1
1 2
3
20 21