logistic regression in lavaan

3,557 views
Skip to first unread message

Jason Lamprianou

unread,
Oct 26, 2014, 3:37:49 PM10/26/14
to lav...@googlegroups.com
Dear all, 
I am fitting this model on data N=2500.

        m <- '
        A=~ x1 + x2
        B =~   x3 + x4
        Y ~     A + B
        '
           
        fit.m <- lavaan::sem(m, ordered=c(x1, x2, x3, x4), data= d ) 

I am trying to use the two latent factors to predict the dichotomous variable Y. The default for lavaan is to use a probit model. However, I want to use a logit model. According to a note I found on the internet, I should use this

 fit.m <- lavaan::sem(m, data= d, estimator="MML", link="logit )

However, lavaan tells me that the "logit" function has not been written yet. 

My questions: 
(a) Is "logit" available or not? I want to use logistic regression to predict Y.
(b) If logit is not availble, I will have to use the default which is probit. Thats fine, but I do not know how to use probit to make various scenarios in lavaan e.g. if x1=xx and x2=xxx and x3=xxxx and x4=xxxxx then the probability for Y=1 is 20%. 

Can anyone please help?

Thank you

Terrence Jorgensen

unread,
Oct 26, 2014, 11:27:41 PM10/26/14
to lav...@googlegroups.com
(a) Is "logit" available or not? I want to use logistic regression to predict Y.

No, not yet.
 
(b) If logit is not availble, I will have to use the default which is probit. Thats fine, but I do not know how to use probit to make various scenarios in lavaan e.g. if x1=xx and x2=xxx and x3=xxxx and x4=xxxxx then the probability for Y=1 is 20%. 

There is a plethora of literature showing that logit and probit give nearly identical results.  The difference is merely the link function.  The logit function takes a probability P (bound between 0 and 1) and transforms it to a logit (LO) on an unbounded continuum:

LO = logit(P) = log( P / (1 - P) )
P = inverse-logit(LO) = exp(LO) / ( 1 + exp(LO) ) 
 
The probit function takes the same probability P and puts in on an unbounded continuum by finding the associated Z score in a standard normal distribution, easily calculated in R using the normal distribution functions:

Z = probit(P) = qnorm(P, mean = 0, sd = 1)
P = pnorm(Z, mean = 0, sd = 1)

The mean/sd arguments are 0/1 by default, so I just included them for illustration.  As in logistic regression, there is not much point in directly interpreting a probit slope.  In probit regression, the slope represents how many z-scores you expect the "outcome" (the probability the outcome = 1) to change for a single unit-increase in that predictor.  In logistic regression, the slope represents how many logit-units you expect the "outcome" (probability the outcome = 1) to change for a single unit-increase in that predictor.  Of course, in logistic regression, you can exponentiate both sides of the equation, which translates into this interpretation: For a 1-unit increase in the predictor, there is a <exponentiated slope> multiplicative change in the ODDS of the outcome (i.e., the exponentiated slope is an odds ratio).  There is no analogously intuitive interpretation of the probit slopes, but you can generate predicted values of the outcome (in Z scores) for certain levels of the predictor(s), then transform those predicted values into probabilities using the pnorm() function as above. Even if those predictors are latent variables, you can choose representative values on the scale of that variable (e.g., the mean and +/- 1 SD from the mean).  You can find more information in the literature or online, for example:


Terry

Nathalie Oexle

unread,
Feb 23, 2015, 5:12:28 AM2/23/15
to lav...@googlegroups.com
Dear all,

I just used the "logit" function in lavaan, and it seems to work.

Can you confirm that the logit function is now available?

Thank you!

Yves Rosseel

unread,
Feb 24, 2015, 2:39:38 AM2/24/15
to lav...@googlegroups.com
On 02/23/2015 11:12 AM, Nathalie Oexle wrote:
> Dear all,
>
> I just used the "logit" function in lavaan, and it seems to work.

Only half. It can work if you ignore standard errors, and use numerical
derivatives, like this:

fit <- cfa(model, data=Data, estimator="MML", verbose=TRUE,
link = "logit", se="none",
control=list(gradient="numerical", rel.tol=1e-8))

and be very, very patient.

This (and a lot more of ML based estimation) is for lavaan 0.6. And
before you ask: When will it be ready? In my job, it seems impossible to
give a reliable answer...

Yves.

Nathalie Oexle

unread,
Feb 24, 2015, 5:41:46 AM2/24/15
to lav...@googlegroups.com
Dear Yves,

Thanks a lot for your answer. In that case I think I will use the probit link instead.

Nathalie

owiidify

unread,
Aug 12, 2019, 6:00:11 PM8/12/19
to lavaan
It seems like "logit" does not work in Lavaan, but "probit" works just fine.

Phil Wood

unread,
Jun 18, 2020, 11:51:32 AM6/18/20
to lavaan
This thread is from five years ago- has the logit link function been added yet? Just curioujs.

vikram sridhar

unread,
Jun 18, 2020, 1:11:43 PM6/18/20
to lav...@googlegroups.com
Upto my knowledge... We won't get logit... We will get only probit coefficient...There is an approximation to logit from probit.. logit = 1.7× probit.... Am also expecting some experts reply... Thank u

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/e6426325-feb0-45da-b025-495023cfb7e6o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages