Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: cloglog, loglog, etc


From   [email protected]
To   [email protected]
Subject   st: RE: cloglog, loglog, etc
Date   Tue, 3 Jan 2006 17:45:44 EST

PLUM does -- in part --   what SAS does. It reverses the response 0/1 
relationship. Stata and many other  software packages parameterize the binary 
response of 1 as a success. SAS and  PLUM do the reverse. Moreover, PLUM's nloglog 
reverses the sign of the standard  loglog output, hence the -n- in nloglog. SAS, 
following other packages, uses the  loglog link. 

With respect to priority, I tend to follow GLIM, the  software developed by 
the founders of GLM methodology. They used the same  parameterization for 
cloglog as did Fisher when he initially derived it in  1922.  

use lbw
gen low0 = 1 if low ==0
replace low0 = 0 if  low==1

SUMMARY   
glm low *,  cloglog              =  gologit2b  low *,  nloglog  (loglog with 
reversed  sign)
glm low0 *,  cloglog           =   gologit2b  low0 *, nloglog (loglog with 
reversed sign)

glm low *,  loglog                =   gologit2b low *,  cloglog
glm low0 *,  loglog              =   gologit2b low0 *,  cloglog

Joe Hilbe


. glm  low age smoke ptl, nolog fam(bin) link(cloglog)

Generalized linear  models                           No. of obs      =        
189
Optimization     :  ML                               Residual df     =        
185
Scale parameter =          1
Deviance         =   222.6159083                     (1/df) Deviance =   
1.203329
Pearson           =   185.6292037                     (1/df) Pearson  =  
1.003401

Variance function: V(u) =  u*(1-u)                   [Bernoulli]
Link function    : g(u) =  ln(-ln(1-u))              [Complementary  log-log]

AIC              =   1.22019
Log likelihood   =  -111.3079541                     BIC             =  
-747.1073

------------------------------------------------------------------------------
|                  OIM
low  |      Coef.   Std.  Err.      z     P>|z|     [95% Conf.  Interval]
-------------+----------------------------------------------------------------
age |   -.047111   .0274916     -1.71   0.087    -.1009935     .0067715
smoke |    .4509498   .2700837     1.67    0.095    -.0784045     .9803041
ptl |    .4689538    .191363     2.45    0.014     .0938892     .8440184
_cons |   -.2137965   .6398918    -0.33    0.738    -1.467961     1.040368
------------------------------------------------------------------------------

.  glm low0 age smoke ptl, nolog fam(bin) link(cloglog)

Generalized linear  models                           No. of obs      =        
189
Optimization     :  ML                               Residual df     =        
185
Scale parameter =          1
Deviance         =   220.0134175                     (1/df) Deviance =   
1.189262
Pearson           =   188.1663766                     (1/df) Pearson  =  
1.017116

Variance function: V(u) =  u*(1-u)                   [Bernoulli]
Link function    : g(u) =  ln(-ln(1-u))              [Complementary  log-log]

AIC              =   1.20642
Log likelihood   =  -110.0067088                     BIC             =  
-749.7098

------------------------------------------------------------------------------
|                  OIM
low0  |      Coef.   Std.  Err.      z     P>|z|     [95% Conf.  Interval]
-------------+----------------------------------------------------------------
age |   .0373414   .0190252      1.96   0.050     .0000526     .0746302
smoke |   -.3452314   .1994667    -1.73    0.083     -.736179     .0457162
ptl |   -.5769123   .2454426    -2.35    0.019    -1.057971    -.0958536
_cons |   -.4593313    .453224    -1.01    0.311    -1.347634     .4289715
------------------------------------------------------------------------------

.  glm low age smoke ptl, nolog fam(bin) link(loglog)

Generalized linear  models                           No. of obs      =        
189
Optimization     :  ML                               Residual df     =        
185
Scale parameter =          1
Deviance         =   220.0134175                     (1/df) Deviance =   
1.189262
Pearson           =   188.1663766                     (1/df) Pearson  =  
1.017116

Variance function: V(u) =  u*(1-u)                   [Bernoulli]
Link function    : g(u) =  -ln(-ln(u))               [Log-log]

AIC              =   1.20642
Log likelihood   =  -110.0067088                     BIC             =  
-749.7098

------------------------------------------------------------------------------
|                  OIM
low  |      Coef.   Std.  Err.      z     P>|z|     [95% Conf.  Interval]
-------------+----------------------------------------------------------------
age |  -.0373414   .0190252    -1.96    0.050    -.0746302    -.0000526
smoke |    .3452314   .1994667     1.73    0.083    -.0457162      .736179
ptl |    .5769123   .2454426     2.35    0.019     .0958536     1.057971
_cons |    .4593313    .453224     1.01    0.311    -.4289715     1.347634
------------------------------------------------------------------------------

glm low0 age smoke ptl, nolog fam(bin) link(loglog)

Generalized linear  models                           No. of obs      =        
189
Optimization     :  ML                               Residual df     =        
185
Scale parameter =          1
Deviance         =   222.6159083                     (1/df) Deviance =   
1.203329
Pearson           =   185.6292037                     (1/df) Pearson  =  
1.003401

Variance function: V(u) =  u*(1-u)                   [Bernoulli]
Link function    : g(u) =  -ln(-ln(u))               [Log-log]

AIC              =   1.22019
Log likelihood   =  -111.3079541                     BIC             =  
-747.1073

------------------------------------------------------------------------------
|                  OIM
low0  |      Coef.   Std.  Err.      z     P>|z|     [95% Conf.  Interval]
-------------+----------------------------------------------------------------
age |    .047111   .0274916      1.71   0.087    -.0067715     .1009935
smoke |   -.4509498   .2700837    -1.67    0.095    -.9803041     .0784045
ptl |   -.4689538    .191363    -2.45    0.014    -.8440184    -.0938892
_cons |    .2137965   .6398918     0.33    0.738    -1.040368     1.467961
------------------------------------------------------------------------------




.  gologit2b low age smoke ptl, nolog link(cloglog)

Generalized Ordered  Cloglog  Estimates              Number of obs   =        
 189
LR chi2(3)      =       14.66
Prob > chi2     =     0.0021
Log  likelihood =  -110.00671                        Pseudo R2       =      
0.0625

------------------------------------------------------------------------------
low |      Coef.   Std.  Err.      z     P>|z|     [95% Conf.  Interval]
-------------+----------------------------------------------------------------
age |  -.0373414   .0190252    -1.96    0.050    -.0746302    -.0000526
smoke |    .3452314   .1994667     1.73    0.083    -.0457162      .736179
ptl |    .5769123   .2454426     2.35    0.019     .0958536     1.057971
_cons |    .4593313    .453224     1.01    0.311    -.4289715     1.347634
------------------------------------------------------------------------------

.  gologit2b low age smoke ptl, nolog link(nloglog)

Generalized Ordered  Nloglog  Estimates              Number of obs   =        
 189
LR chi2(3)      =       12.06
Prob > chi2     =     0.0072
Log  likelihood =  -111.30795                        Pseudo R2       =      
0.0514

------------------------------------------------------------------------------
low |      Coef.   Std.  Err.      z     P>|z|     [95% Conf.  Interval]
-------------+----------------------------------------------------------------
age |   -.047111   .0274916     -1.71   0.087    -.1009935     .0067716
smoke |    .4509498   .2700837     1.67    0.095    -.0784045     .9803041
ptl |    .4689538    .191363     2.45    0.014     .0938892     .8440184
_cons |   -.2137968   .6398918    -0.33    0.738    -1.467962     1.040368
------------------------------------------------------------------------------

.  . gologit2b low0 age smoke ptl, nolog link(cloglog)

Generalized Ordered  Cloglog  Estimates              Number of obs   =        
 189
LR chi2(3)      =       12.06
Prob > chi2     =     0.0072
Log  likelihood =  -111.30795                        Pseudo R2       =      
0.0514

------------------------------------------------------------------------------
low0 |      Coef.   Std.  Err.      z     P>|z|     [95% Conf.  Interval]
-------------+----------------------------------------------------------------
age |    .047111   .0274916      1.71   0.087    -.0067716     .1009935
smoke |   -.4509498   .2700837    -1.67    0.095    -.9803041     .0784045
ptl |   -.4689538    .191363    -2.45    0.014    -.8440183    -.0938892
_cons |    .2137967   .6398917     0.33    0.738    -1.040368     1.467961
------------------------------------------------------------------------------

.  gologit2b low0 age smoke ptl, nolog link(nloglog)

Generalized Ordered  Nloglog  Estimates              Number of obs   =        
 189
LR chi2(3)      =       14.66
Prob > chi2     =     0.0021
Log  likelihood =  -110.00671                        Pseudo R2       =      
0.0625

------------------------------------------------------------------------------
low0 |      Coef.   Std.  Err.      z     P>|z|     [95% Conf.  Interval]
-------------+----------------------------------------------------------------
age |   .0373414   .0190252      1.96   0.050     .0000526     .0746302
smoke |   -.3452314   .1994667    -1.73    0.083     -.736179     .0457162
ptl |   -.5769123   .2454426    -2.35    0.019    -1.057971    -.0958536
_cons |   -.4593313    .453224    -1.01    0.311    -1.347634     .4289715
------------------------------------------------------------------------------

.  







One last thing - here are examples of how to  clone what spss does in 
PLUM, including its test of parallel lines. i.e.  this gives you 
ordered logit, ordered probit, etc.  I can send you the  corresponding 
SPSS output if you want.

webuse nhanes2f,  clear

* Logit link (default)
gologit2c health female black age, pl lrf  link(l) store(logit_pl)
quietly gologit2c health female black age, npl lrf  link(l) store(logit_npl)
* Clone SPSS's test of parallel lines
lrtest  logit_pl logit_npl

* Probit link
gologit2c health female black age, pl  lrf link(p) store(probit_pl)
quietly gologit2c health female black age, npl  lrf link(p) store(probit_npl)
* Clone SPSS's test of parallel lines
lrtest  probit_pl probit_npl

* SPSS's cloglog, which Stata calls  loglog
gologit2c health female black age, pl lrf link(c)  store(cloglog_pl)
quietly gologit2c health female black age, npl lrf link(c)  store(cloglog_npl)
lrtest cloglog_pl cloglog_npl

* SPSS's nloglog,  which Stata calls cloglog
gologit2c health female black age, pl lrf link(n)  store(nloglog_pl)
quietly gologit2c health female black age, npl lrf link(n)  store(nloglog_npl)
lrtest nloglog_pl  nloglog_npl




-------------------------------------------
Richard  Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668,  (574)631-6463
FAX:    (574)288-4373
HOME:    (574)289-5227
EMAIL:  [email protected]
WWW  (personal):    http://www.nd.edu/~rwilliam
WWW  (department):    http://www.nd.edu/~soc  

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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