fsu seal Florida State University
  Center home>> help>> stat faq>> logistic
 

Scott Long's postestimation commands on Logistic Rregression



We know the logistic regression model is linear in the log odds

ln (o) = b0 + b1 X1 + b2 X2 + ... To ask STATA to run a logistic regression, we may use either logit or, logistic command. . logit (coefficients of the independent variables measured in logged odds) e.g. . logit depvar indep_var1 indep_var2 indep_var3 . logistic (presents the coefficients in odds ratios) The odds coefficients can be obtained also with the logit command by using the option or after the command, thus: . logit depvar indep_var1 indep_var2 indep_var3, or = . logistic depvar indep_var1 indep_var2 indep_var3 Our difficulty is not getting the coefficients or odds ratios, rather, how to interpreting them: Option 1: interpreting coefficients: difficult. Option 2: interpreting odds ratios: not very difficult, but easy to be misleading,since odds ratios do not equal to probability.For example, if 20% of female students smoke, and 40% of male students smoke, the odd ratios of male and female students smoking is,if you interpret this result as “male students are 2.67 times more likely to be a smoker than female students” would be wrong, Since the probability of male students smoking is 40%, and 20% for female students,thus “male students are only twice more likely to be a smoker than female students.” Option 3: Interpreting probability: would be much easier. When dealing with probabilities, one of the most useful commands is: . prchange
(Authors: J.Scott Long and Jeremy Freese;www.indiana.edu/~jslsoc/spost.htm;spostsup@indiana.edu) (if you see “unrecognized command: prchange” after you enter command, this means since prchang is not built-in Stata routine, you need to install this user-written add-on program. You can put command: .findit prchange And click the first link under “Web resources from Stata and other users: spost9_ado from http://www.indiana.edu/~jslsoc/stata Distribution-date: 04Jun2007 / spost9_ado Stata 9 commands for the post-estimation interpretation of / regression models. Use package spostado.pkg for Stata 8. / Based on Long & Freese - Regression Models for Categorical Dependent / Variables Using Stata. Second Edition. / Support And then click: (click here to install) ("prchange computes discrete and marginal change for regression models for categorical and count variables. Marginal change is the partial derivative of the predicted probability or predicted rate with respect to the independent variables. Discrete change is the difference in the predicted value as one independent variable changes values while all others are held constant at specified values.") Example: data from Jay’s Transitions Study Young Adult Wave II: Dependent variable ciga : Have you ever smoked more than 10 cigarettes in a single day? (1=yes, 0=no). Independent variables: race (1=non-Hispanic white; 0= other race).
 

. use http://cdph.fsu.edu/people/minxing/transyt2_s.dta

. logistic ciga race

Logistic regression                               Number of obs   =       1204
                                                  LR chi2(1)      =      23.96
                                                  Prob > chi2     =     0.0000
Log likelihood = -686.17107                       Pseudo R2       =     0.0172

------------------------------------------------------------------------------
        ciga | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        race |   2.010997   .2837647     4.95   0.000      1.52511    2.651682
------------------------------------------------------------------------------

. prchange

logistic: Changes in Probabilities for ciga

      min->max      0->1     -+1/2    -+sd/2  MargEfct
race    0.1448    0.1448    0.1348    0.0595    0.1353

              0       1
Pr(y|x)  0.7375  0.2625

           race
    x=  .262458
sd(x)=  .440153

Note 1: from Odds Ratio Table: very often people might interpret as: Whites are about TWICE more likely to smoked more than 10 cigarettes in a single day THAN other race people. However, if we look Probabilities Table, we find the probability only increase 14.48 percent for whites, it is far less than twice. Note 2: Probability Table: the first column shows the change in the probabilities when the independent variable varies from its minimum to its maximum. The second shows the change when the independent variable varies from 0 to 1. This is the most useful when analysing dummy variables. The third and fourth columns show the change in probabilities when the independent variable varies one unit in real value or in standard deviations, respectively. The last column presents the marginal changes of the independent variable. All this values are calculated at the predicted probability when the independent variables take their mean values, which are listed just below this table.

How about if you want to know the predicted probabilities of positive outcome for your dependent variable for specific population?
For example, if you want to know the predicted probabilities of ever smoking 10 cigarettes in a single day for white female, you may use command:prtab



. prtab race sex

logistic: Predicted probabilities of positive outcome for ciga

--------------------------
1=non-his |
panic     |
white;0=o |0=female,1=male
thers     |      0       1
----------+---------------
        0 | 0.2101  0.2445
        1 | 0.3472  0.3930
--------------------------

         race        sex
x=  .26245847  .54734219

this Table teels us, for example, for white female students, the predicted probability of positive outcome is around .347

prtab is able to present a one- to four-way table of the predicted values (probabilities, rate) for different combinations of values of independent variable.

How to make plots showing the predicted probabilities change when one independent variable varies over a specified range while the others are held in a specific value?
For example, if you want to make plots showing how the predicted probabilities of dependent variable (ciga) change when the frequency of church/synagogue services attendance varies from 1 (never) to 5 (more than once a week) while race and sex are held in a specific value (e.g. white male, white female, other male, and other female)? Firstly, you need to compute predicted values by using command: prgen


use http://cdph.fsu.edu/people/minxing/transyt2_s.dta
logistic ciga race sex church

prgen church, from(1) to(5) gen(prg1) x(sex=0 race=0)
prgen church, from(1) to(5) gen(prg2) x(sex=1 race=0)
prgen church, from(1) to(5) gen(prg3) x(sex=0 race=1)
prgen church, from(1) to(5) gen(prg4) x(sex=1 race=1)
Then, you may use graphical command to create plots:

twoway connected prg1p1 prg2p1 prg3p1 prg4p1 prg1x, msym(O D S T)

prtab is able to present a one- to four-way table of the predicted values (probabilities, rate) for different combinations of values of independent variable. NOTE: prchange, prtab, prgen work with many regression models such as: logit, mlogit, mprobit, nbreg, ologit, oprobit, probit, etc.. more information are available from http://www.indiana.edu/~jslsoc/spost.htm back to previous page