fixed.x = FALSE
sem(model, data=x, fixed.x = FALSE)
lavaan ERROR: unordered factor(s) detected; make them numeric or ordered:
Hey @all,I have several questions:First of all I want to specify the covariance between exogenous variablesq1: the lavaan-default does not estimate the covariance between exogenous variables?
If lavaan does not estimate the covariance, q2 it is possible to modify the default with:to estimate the covariance.
fixed.x = FALSE
I have some exogenous categorical variables in my model and it works well. But if i fix my code with
sem(model, data=x, fixed.x = FALSE)I get an error message:lavaan ERROR: unordered factor(s) detected; make them numeric or ordered:
I know this error very well from my beginning with lavaan, but I fixed it soon (Tutorial). So the error message only comes, when I modify my code with fixed.x = FalseI hope it is not a redundant problem and I am looking forward to your helpthanks,marco
--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.
mod <-
'lat_var1 =~ x1 + x2 + x3
lat_var2 =~ x4 + x5 + x6
#Regression
lat_var1 ~ var_1 + var_2
lat_var2 ~ var_1 + var_2
#now i want the covariance between the exogenous variables (var_1 and var_2)
var_1 ~~ var_2
#in the SEM-Function I set fixed.x= TRUE
mod.fit <- sem(mod, data=data, fixed.x=TRUE)
fixed.x = TRUE
#and
fixed.x FALSE
lavaan WARNING: syntax contains parameters involving exogenous covariates; switching to fixed.x = FALSE
It says that because you are specifying a covariance and it's telling you that specifying a covariance and setting that to TRUE makes no sense and therefore lavaan is overriding your decision.
Compare:
model <- '
# latent variable definitions
ind60 =~ x1 + x2 + x3
dem65 =~ y5 + y6 + y7
# regressions
dem65 ~ y1 + y2
ind60 ~ y1 + y2
# residual correlations
y1 ~~ y2
'
fit <- sem(model, data=PoliticalDemocracy)
summary(fit)
to:
model <- '
# latent variable definitions
ind60 =~ x1 + x2 + x3
dem65 =~ y5 + y6 + y7
# regressions
dem65 ~ y1 + y2
ind60 ~ y1 + y2
'
fit <- sem(model, data=PoliticalDemocracy, fixed.x = FALSE)
summary(fit)
to:
model <- '
# latent variable definitions
ind60 =~ x1 + x2 + x3
dem65 =~ y5 + y6 + y7
# regressions
dem65 ~ y1 + y2
ind60 ~ y1 + y2
'
fit <- sem(model, data=PoliticalDemocracy, fixed.x = TRUE)
summary(fit)