Skip to first unread message

Mar 29, 2020, 7:34:12 PM3/29/20

to lavaan

Dear community,

I have two kind'a related questions and any help will be much appreciated.

1- As far as I understand, lavaan still does not have the logit link even if the help file states otherwise. Is this correct? So, probit is the only way to go if we have a binary outcome variable?

2- Let's say I have the following baby model with a binary outcome variable (*vote*) where I use a probit link. What would be the easiest way to plot the predicted probability plot for the latent variable, *conf*? (Predicted probabilities for different values of conf fixing all other variables.)

Note that *conf* is also in the mediated through *migr*.

model <- '

# 1. measurement model

conf =~ k1 + k2

univ =~ k3 + k4

# outcome model

vote ~ c1*conf + c2*univ + b1*migr + age + gender

# mediator models

migr ~ a1*conf + a2*univ + age + gender

# indirect effects (IDE)

migrconf := b1*a1

migruniv := b1*a2

# total effects

totalConf := c1 + migrconf

totalConf := c2 + migruniv

'

Mar 30, 2020, 10:29:39 AM3/30/20

to lavaan

Ugur,

I believe your are correct about the logit link. This is not something that I do every day, so hopefully I have not missed anything. Here is a simple example.

Keith

------------------------

Keith A. Markus

John Jay College of Criminal Justice, CUNY

http://jjcweb.jjay.cuny.edu/kmarkus

Frontiers of Test Validity Theory: Measurement, Causation and Meaning.

http://www.routledge.com/books/details/9781841692203/

I believe your are correct about the logit link. This is not something that I do every day, so hopefully I have not missed anything. Here is a simple example.

`summary(HolzingerSwineford1939)`

# simplified mediation model

babyModel <- '

school ~ x1 + x2

x1 ~ x2

school~~school

x1~~x1

school | t1

x1 ~ 1

' # end babyModel

# Examine and Fit model

lavaanify(babyModel)

babyFit <- lavaan(babyModel, data=HolzingerSwineford1939, ordered=c('school'))

summary(babyFit)

# Extract coefficients from model fit

babyCoef <- coef(babyFit)

# Choose a set a values for the predictor

plotX2 <- seq(from=0, to=9, len=100)

# Predict mediator values

plotX1 <- babyCoef[6] + babyCoef[3]*plotX2

# Predict latent continuous outcome values

plotSchoolZ <- babyCoef[1]*plotX1 + babyCoef[2]*plotX2

# predict probabilities

plotSchoolP <- pnorm(plotSchoolZ)

# Draw plot

plot(x=plotX2, y=plotSchoolP, type='l', lwd=2, xlab='Mediated Predictor',

ylab='Predicted Probability of Outcome', main='Predicted Probability Plot')

Keith

------------------------

Keith A. Markus

John Jay College of Criminal Justice, CUNY

http://jjcweb.jjay.cuny.edu/kmarkus

Frontiers of Test Validity Theory: Measurement, Causation and Meaning.

http://www.routledge.com/books/details/9781841692203/

Mar 30, 2020, 7:36:44 PM3/30/20

to lavaan

Hi Keith,

Thank you very much for your response. It was tedious but I was able to do it, and your example code definitely helped.

Cheers,

Ugur

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu