335 questions
0
votes
0
answers
27
views
R: How would I use lavaan in R to create a latent longitudinal growth curve model with a binary outcome?
I am specifying a latent longitudinal growth curve model in R with multiple time-invariant covariates. However, my outcome is binary (0/1). I read through the growth() function documentation, but didn'...
0
votes
1
answer
77
views
UTAUT model in lavaan: "modifier label specified multiple times"
I am trying to perform an UTAUT model with the help of lavaan in Rstudio. In particular testing hypothesis such as:
H2 <- '
EE =~ V10+V11+V12
BI =~ V28+V29+V30
BI ~ EE + V43*EE + V45*EE + V43 + ...
2
votes
0
answers
60
views
Poor Recovery of Factor Loadings and Covariances in R Using Monte Carlo in Tidyverse
I am using secondary data to build a measurement model in R and, for proof of concept, I am trying to simulate data from this measurement model and fit it to the original model to show that it will ...
0
votes
0
answers
18
views
lavaan probit model: calculation of simple slopes and std. error
I am trying to implement the calculation for simple slopes estimation for probit models in lavaan as it is currently not support in semTools.
The idea is to be able to plot the slope of a regression ...
0
votes
1
answer
34
views
Robust estimators for lavaan::cfa fails to converge (data strongly violates multivariate normality)
Problem Introduction
Hi everyone,
I’m working with a clean dataset of N = 724 participants who completed a personality test based on the HEXACO model. The test is designed to measure 24 sub-components ...
0
votes
0
answers
32
views
Longitudinal Mediation Analysis with Binary DV
So, I am testing a longitudinal mediation analysis, and here is my model:
Model
JOV and NFS are continuous variables, but SS is a binary variable (0 v 1). So, I put this script in R:
modelz <- '
# ...
0
votes
1
answer
109
views
Random effects lavaan
I am running a sem() model and I am trying to include a random effects.
Dataframe:
test <- data.frame(Person = c("a", "a","a", "b", "b", "b&...
1
vote
0
answers
22
views
R - Adding manifest exogenous variable to SEM leads to error
I am new to SEM, and some help would be very appreciated.
I want to specify a model with one latent endogenous variable (indicators are all ordinal), five latent exogenous variables (indicators are ...
0
votes
0
answers
20
views
Complex SEM Model in lavaan with moderations of latent variables
wished SEM Model
I need to model the image in R, and I'm a beginner. I tried to do it as follows, but I'm not sure if it's correct. Any help would be greatly appreciated!
We have longitudinal data!
...
0
votes
0
answers
62
views
How to obtain standardized residuals for clustered data in lavaan?
I am facing a problem concerning the output of standardized residuals for a fitted lavaan (sem)-object. As far as I do not include “cluster = ” in the fitting function, I can easily obtain the ...
1
vote
1
answer
216
views
Encountered lav_object_summary Error while running CFA
This is my code:
DATA <- read_excel("FINAL DATA.xlsx")
CFA1 <-'
F1 =~ Q1 + Q2 + Q3 + Q4
F2 =~ Q5 + Q6 + Q7 + Q8
F3 =~ Q9 + Q10 + Q11 + Q12
F4 =~ ...
0
votes
0
answers
34
views
Moderated Mediation Model with Three Moderators?
I'm trying to run a moderated mediation model with three moderators. I was unable to identify a model in PROCESS (Hayes) taht allows for this.
I've been told that it's possible in lavaan however, I'm ...
0
votes
1
answer
112
views
How to calculate effect sizes for predictors in lavaan regression model?
Is there a way to calculate an effect size for each predictor in a lavaan model like this?
(lavaan in this example is just used to be able to use FIML, otherwise it's a simple linear regression)
model ...
1
vote
2
answers
222
views
Retrieving p-value of overall significance of simple lavaan model
How can I retrieve the p-value of the overall significance of a simple lavaan model?
Just similar to the p-value for the F-statistic in standard linear regression done with lm().
model <- sem('...
0
votes
0
answers
45
views
lavaan-Decompose variance explained in sequential mediation
I am using sequential mediation analyses (aka serial mediation) in lavaan in R.
Below is my model
model <- "y ~ a*x1 + b*x2 + c*x3 + d*x4
x1 ~ b1*x2 + c2*x3 + d2*x4
x2 ~ c3*x3 + d3*x4
x2_y := ...
0
votes
0
answers
50
views
Implementing a Structural Equation Model with lasso regression
I have the following structural equation model (SEM) structure in mind:
In reality there are more than 3,2, resp. 3 variables, so I want to use lasso regression for the arrows. Is it possible to ...
3
votes
0
answers
257
views
How to include time and unit fixed effects in a mediation model using R?
I'm trying to get the indirect effects of the mediation variables m1, m2, and m3 in my dependent variable "y". But also considering the effect of the independent variable "iv" on ...
0
votes
0
answers
156
views
Creating summary() of a lavaan.mi object (runMI())
So I am trying to use the runMI() function of the semTools package to fit a multiple impute ordinal MG-CFA model. However, it seems like R isn't finding the correct summary() methods for lavaan.mi-...
0
votes
0
answers
20
views
Unparametered Mediation paths SEM with same degree of freedom comparison
I am modeling multilevel mediation paths for my data. The idea is that a1,a2,b1, b2, c1, c2,d1, and d2 all contribute to outcome variable y (model1), and b-level, c-level, and d-level variables also ...
0
votes
0
answers
134
views
Why CFI=1 and RMSEA=0 in lavaan
I
ran an CFA with lavaan and received the folloing output:
> summary(CFAmodel_nofMRI_all_output, fit.measures = TRUE, standardized=TRUE)
lavaan 0.6.15 ended normally after 48 iterations
...
0
votes
0
answers
33
views
How do I perform moderation analysis in Lavaan?
I want to perform two moderations in this model using lavaan :
model_1 <- " # Measurement Model
attitude =~ 45.probu + 46.probu + 47.probu+ 50.probu
perceived_control =~ 127.EXPECTATION1 + ...
0
votes
1
answer
42
views
how to visually indicate the highest correlations in a polychoric correlation matrix with highly correlated items across the board?
I have a 25-item likert style type scale and I am looking to reduce the scale. I just obtained a polychoric correlation matrix and noticed that the inter-item correlations are really high across the ...
0
votes
0
answers
30
views
How do I use a latent variable stigma to predict another latent variable depression using R lavaan
I am trying to use a measurement model with stigma as the factor that is measured by 12 items to predict depression which is measured by 20 items. I am thinking of structuring this as one latent ...
0
votes
1
answer
135
views
How to visualize a complex Bifactor SEM with Third-order Factor?
I'm working on visualizing a complex bifactor Structural Equation Modeling (SEM) in R with a third-order factor (AUTOREGULACION) and several nested factors.
I've run into issues with layout when ...
0
votes
1
answer
34
views
Indirect relationships in Lavaan R
Are my results of a bootstrapped indirect effect within a multilevel sem model reliable in case the upper value of the 95% CI is higher then one:
monteCarloCI(FactorA, standardized=TRUE, reps=20000)
...
1
vote
1
answer
55
views
R for-loop reverting back to previous values [closed]
I am attempting to simulate data using the simstudy package and then calculate coefficient omega with the psych package. I am using for-loops to run through different values for within cluster ...
0
votes
1
answer
47
views
Obtaining corr matrix (probit residual correlations) for observed variables after fitting an EFA model using lavaan
Looks like lavaan's efa() function does not have an option to generate the correlation matrix for observed variables. I wonder how can I obtain the corr matrix (probit residual correlations) for ...
0
votes
0
answers
52
views
Using FIML and bootstrapping with BCa for very simple regression model
aI need to calculate a very simple regression model outcome ~ predictor, where outcome is continuous and predictor is binary. To treat missings, I have to use FIML (full information maximum ...
0
votes
0
answers
139
views
Latent change score using lavaan with observed variables measured at two time points (and comparing results with traditional repeated measures anova)
I would like to carry on a latent change score model for 5 different psychological constructs measured at two time points in lavaan. People told me it can do ok with missing data. I'm struggling with ...
0
votes
1
answer
39
views
How to get fiml.regression wrapper function working for estimating an lm() model in lavaan
I would like to use the fiml.regression wrapper function to estimate an lm() model in lavaan: https://rdrr.io/github/jbiesanz/fabs/man/fiml.regression.html
But unfortunately, can't get the function to ...
1
vote
0
answers
129
views
How to ask lavaanPlot to show the error terms variances for both observed and latent factor
I am trying to modify the code below such that the plot shows the error term variances for both observed and latent variables. Does lavaanPlot provide such an option?
# Load libraries:
library(...
0
votes
0
answers
29
views
how can I write indirect and direct effects conditional on moderator, also index of moderated mediation?
I'm trying to run the attached model in lavaan since I will compare two groups.
structural model will be look like as following If I'm not wrong
model15 <- ' M ~ a.X
Y ~ c1*X + b1*M + c2*...
0
votes
1
answer
164
views
Error when trying to knit related to lavaan
I'm getting this error message when trying to knit. Any suggestions?
Quitting from lines 25-90 [unnamed-chunk-1] (Week-4-Assignment_KK.Rmd)
Error in if (categorical.flag) ...:
! argument is of length ...
0
votes
1
answer
90
views
How to include a nominal factor variable in Confirmatory Factor Analysis using lavaan package
Using the code below, I am trying to fit a CFA model using laavan package. One of my observed variables is nominal with 5 categories (HOUSEHOLD_I), two of them are ordinal, and the remaining are ...
0
votes
0
answers
64
views
Moderation and Mediation model
I am trying to fit a moderation mediation model (please see the figure)
So I have a clasic mediation model and a moderator for the association between the mediator and the outcome.
I want to fit this ...
0
votes
1
answer
221
views
How to access p-values and fit estimates after pooling results from large lavaan.mi object?
I tried to access p-values exactly as shown by Hall & Clark (2023):
All analyses were conducted in R, with the SEMs estimated using the
lavaan package (Rosseel, 2012). Missing data were handled ...
0
votes
0
answers
48
views
Lavaan Multigroup CFA not producing output with data on multiple groups
I am trying to run a multigroup CFA using lavaan with the code below
fjcfa<-'fjqual=~firstjob_desired+firstjob_meaning+firstjob_grow+firstjob_mobility+firstjob_satisfy+firstjob_skills+firstjob_majr
...
1
vote
0
answers
76
views
How can I make graph readable using semPath
How can I change my code that the graph is readable? I tried a few things but nothing seems to work. Here is the code:
Test.model <- '
MS =~ M_1 + M_2 + M_3
MV =~ M_4 + M_5 + M_6
MP =~ M_7 + M_8 + ...
0
votes
1
answer
736
views
Point Biserial Correlation across Multiple variables in R
I am trying calculate a correlation across multiple variables. Most of my variables are continuous, but one of them is binary. I would like to produce a single matrix with all of my variables in the ...
0
votes
1
answer
430
views
How do I classify binary indicator variables in SEM using WLSMV in R (lavaan)
I am developing a SEM using lavaan in R. I have continuous, ordinal and binary variables. I keep getting the following error codes for my binary variables (set as.factor) when I try to run the model ...
1
vote
1
answer
347
views
Multigroup SEM in lavaan: no variance in covariate in one group, how to proceed?
I try to fit a multigroup SEM in lavaan.
In one of my groups all values for a specific covariate are the same (i.e., the people in group 2 all have the same age), in my group 1 however this covariate (...
0
votes
1
answer
269
views
duplicate model element - lavaan
I am running a SEM with lavaan for mediation analysis and am running into this error:
lavaan ERROR: duplicate model element in: Outcome ~ b*mediator + covariate + covariate + covariate + covariate
...
0
votes
1
answer
369
views
Error in lavaan, "row names contain missing values", when using summary() , requesting rsquare
I'm using a large-ish, somewhat messy dataset, and using lavaan to run a regression. I'm able to get parameter estimates through parameterEstimates() and standardizedSolution(), which I have cross-...
1
vote
1
answer
180
views
Ordinal + Continuous interaction in lavaan
I'm completing a moderation mediation analysis in lavaan.
All of my variables are continuous other than my mediator, which is an ordinal with 3 levels (0,1,2). Lavaan can't handle interactions between ...
0
votes
0
answers
76
views
Error in corCFA(fun_call = match.call(), ...) : object 'mycor' not found
I have an scale of problematic internet use with 5 items rating from 1 to 5. I am trying to get omega coefficient as recommended by Flora (2020), but I get the following error:
Make example ...
0
votes
1
answer
193
views
Path diagram plot: latent growth curve model customisation
I have created a latent growth curve model in lavaan and created a path diagram to represent this. However, on the path diagram plot I would like to...
remove the intercepts for specific vairables; ...
0
votes
0
answers
171
views
Mediation & Moderation w/ an Ordinal Variable in R package lavaan sem function (v0.6.16)
I have x1, x2, m, and y where m is an ordered three-level categorical variable. The model is as follows.
m ~ a*x1
y ~ cx1 + x2 + bm + x2:m
Since m is an ordinal variable, we cannot create this x2:m ...
0
votes
2
answers
206
views
Create a path diagram to summarise a bootstrapLavaan CFA model in R
I have been using bootstrapLavaan for the first time, to perform confirmatory factor analysis. It runs fine and I have been able to summarise the CFA output. However, I have not been able to create a ...
0
votes
2
answers
227
views
What is the meaning of the dotted links that connect a latent variable and a manifest variable in an SEM?
i conduct SEM with lavaan under Jamovi (SEMLj), and i can't understand what do represent dotted links that connect a latent variable and a manifest variable.
My Model and path diagram
Is it possible ...
0
votes
1
answer
454
views
CFA on non-normal ordinal data
I hope you are doing well,
I'm taking my first steps in R and the Lavaan Package, and I'm trying to investigate the factorial structure of a measure related to dating victimization. The sample ...