Skip to first unread message

Nov 15, 2018, 5:14:18 AM11/15/18

to lavaan

Hey @all,

I have several questions:

First of all I want to specify the covariance between exogenous variables

q1: 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 = False

I hope it is not a redundant problem and I am looking forward to your help

thanks,

marco

Nov 15, 2018, 11:53:10 AM11/15/18

to lav...@googlegroups.com

On Thu, Nov 15, 2018 at 4:14 AM unordered <team.pro...@gmail.com> wrote:

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?

That's correct.

If lavaan does not estimate the covariance, q2 it is possible to modify the default with:to estimate the covariance.

fixed.x = FALSE

You would set fixed.x = TRUE

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:`

You need to fix this and as the message says either make theM factors (look at str(x)) and change them to numeric or ordered variables. This is unrelated to your fixed.x = FALSE questions though.

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.

Nov 16, 2018, 4:43:50 AM11/16/18

to lavaan

Hey Christopher,

it goes forward, but I still have some questions:

I fixed the problem with the categorical variables.

Now I want to be sure about estimation of exogenous variable

lets say i have the follow simple code:

`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)

now i estimate freely the covariance between var_1 and var_2 and the results are different from the results without covariance.

There is no difference in the output between

`fixed.x = TRUE`

#and

fixed.x FALSE

What is the difference in the Argument TRUE and FALSE?

again: thanks a lot for your help!

marco

Nov 16, 2018, 6:33:23 PM11/16/18

to lav...@googlegroups.com

It's because you are overriding the fixed.x = TRUE with the exogenous covariance. Presumably, you saw this WARNING message when you specified fixed.x = TRUE.

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)

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu