[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: re: logistic function

From   "Nick Cox" <>
To   <>
Subject   st: RE: re: logistic function
Date   Thu, 18 Jun 2009 17:58:51 +0100

In addition, or alternatively, check out -invlogit()-. 


Kit Baum

John wanted to do nonlinear predictions from an estimated logit model.  
Wikipedia (or Wolfram's MathSource) is his friend:

sysuse auto,clear
logit foreign trunk mpg  d
// mean of predictions is equal to mean of foreign in logit
su foreign, mean
scalar mu = r(mean)
su trunk, mean
scalar mut = r(mean)
su mpg, mean
scalar mum = r(mean)
// form of CDF from
scalar s = sqrt(2*c(pi)/3)
local cum1  1/(1+exp(-((_b[_cons]+ _b[trunk]*mut + _b[mpg]*mum +  
_b[d]*1) - mu)/s))
local cum0  1/(1+exp(-((_b[_cons]+ _b[trunk]*mut + _b[mpg]*mum +  
_b[d]*0) - mu)/s))
di "`cum1'"
di "`cum0'"
predictnl dfdd1= `cum1' - `cum0' in 1, se(serr1)
l dfdd1 serr1 in 1

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index