Regression models for categorical dependent variables using Stata
Author: Long, J. Scott ; Freese, JeremyPublisher: Stata Press, 2006.Edition: 2nd ed.Language: EnglishDescription: 527 p. : Graphs/Ill. ; 24 cm.ISBN: 1597180114Type of document: BookBibliography/Index: Includes bibliographical references and indexItem type | Current location | Collection | Call number | Status | Date due | Barcode | Item holds |
---|---|---|---|---|---|---|---|
![]() |
Asia Campus Main Collection |
QA278.2 .L66 2006
(Browse shelf) 900097886 |
Available | 900097886 |
Includes bibliographical references and index
Digitized
Regression models for categorical dependent variables using Stata Contents Preface xxix I General Informat ion 1 Introduction 1.1 1.2 1.3 What is this book about? 3 .......................... Which models are considered? . . . . . . . . . . . . . . . . . . . . . . . ........................ 3 4 5 5 7 Whom is this book for? . . . . . . . . . . . . . . . . . . . . . . . . . . . How is the book organized? 1.4 1.5 What software do you need? . . . . . . . . . . . . . . . . . . . . . . . . 1.5.1 1.5.2 Updating Stata 9 . . . . . . . . . . . . . . . . . . . . . . . . . InstallingSPost . . . . . . . . . . . . . . . . . . . . . . . . . . Installing SPost using search . . . . . . . . . . . . . . . . . . . Installing SPost using net install . . . . . . . . . . . . . . . . . 8 9 9 11 11 12 12 13 13 15 1.5.3 1.5.4 1.5.5 1.5.6 1.6 What if commands do not work? . . . . . . . . . . . . . . . . . Uninstalling SPost . . . . . . . . . . . . . . . . . . . . . . . . . Using spex to load data and run examples . . . . . . . . . . . More files available on the web site ............... Where can I learn more about the models? . . . . . . . . . . . . . . . . 2 Introduction to Stata 2.1 The Stata interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Changing the scrollback buffer size 16 18 ............... Changing the display of variable names in the Variables window 19 2.2 Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.3 How to get help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 2.3.2 Online help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Manuals .............................. . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.3 2.4 2.5 2.6 Other resources . . . . . . . . . . . . . . . . . . . . . . . . . . The working directory Stata file types ............................... Saving output to log files . . . . . . . . . . . . . . . . . . . . . . . . . . Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6.1 2.6.2 2.6.3 Closing a log file .......................... . . . . . . Viewing a log file . . . . . . . . . . . . . . . . . . . . . . . . . Converting from SMCL to plain text or Postscript 2.7 Using and saving datasets 2.7.1 2.7.2 2.7.3 ......................... Data in Stata format . . . . . . . . . . . . . . . . . . . . . . . Data in other format.s . . . . . . . . . . . . . . . . . . . . . . . Entering data by hand . . . . . . . . . . . . . . . . . . . . . . 2.8 2.9 Size limitations on datasets* . . . . . . . . . . . . . . . . . . . . . . . . Do-files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.9.1 2.9.2 2.9.3 2.9.4 Adding comments . . . . . . . . . . . . . . . . . . . . . . . . . Long lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Stopping a do-file while it is running . . . . . . . . . . . . . . Creating do-files . . . . . . . . . . . . . . . . . . . . . . . . . . Using Stata's Do-file Editor . . . . . . . . . . . . . . . . . . . Using other editors to create do-files . . . . . . . . . . . . . . . 2.9.5 2.10 Recommended structure for do-files . . . . . . . . . . . . . . . Using Stata for serious data analysis . . . . . . . . . . . . . . . . . . . 2.11 Syntax of Stata commands 2.11.1 2.11.2 2.11.3 ......................... Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Variable lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . if and in qualifiers ......................... Examples of if qualifier . . . . . . . . . . . . . . . . . . . . . . 2.11.4 2.12 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Managing data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.12.1 2.12.2 2.12.3 2.12.4 2.12.5 Looking a t your data . . . . . . . . . . . . . . . . . . . . . . . Getting information about variables . . . . . . . . . . . . . . . Missing values . . . . . . . . . . . . . . . . . . . . . . . . . . . Selecting observations . . . . . . . . . . . . . . . . . . . . . . . Selecting variables . . . . . . . . . . . . . . . . . . . . . . . . . 2.13 Creating new variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.13.1 2.13.2 2.13.3 2.13.4 generate command . . . . . . . . . . . . . . . . . . . . . . . . . replace command . . . . . . . . . . . . . . . . . . . . . . . . . recode command . . . . . . . . . . . . . . . . . . . . . . . . . . Common transformations for RHS variables . . . . . . . . . . Breaking a categorical variable into a set of binary variables . More examples of creating binary variables . . . . . . . . . . . Nonlinear transformations . . . . . . . . . . . . . . . . . . . . Interaction terms . . . . . . . . . . . . . . . . . . . . . . . . . 2.14 Labeling variables and values 2.14.1 2.14.2 2.14.3 2.15 2.16 . . . . . . . . . . . . . . . . . . . . . . . Variable labels . . . . . . . . . . . . . . . . . . . . . . . . . . . Value labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . notes command . . . . . . . . . . . . . . . . . . . . . . . . . . Global and local macros . . . . . . . . . . . . . . . . . . . . . . . . . . Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.16.1 2.16.2 2.16.3 2.16.4 graph command . . . . . . . . . . . . . . . . . . . . . . . . . . Displaying previously drawn graphs . . . . . . . . . . . . . . . Printing graphs .......................... Combining graphs . . . . . . . . . . . . . . . . . . . . . . . . . 2.17 A brief tutorial ............................... A batch version . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Estimation. testing. fit. and interpretation 3.1 Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1 3.1.2 3.1.3 3.1.4 Stata's output for ML estimation . . . . . . . . . . . . . . . . ML and sample size . . . . . . . . . . . . . . . . . . . . . . . . Problems in obtaining ML estimates ............... Syntax of estimation commands . . . . . . . . . . . . . . . . . Variable lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . Specifying the estimation sample . . . . . . . . . . . . . . . . . Weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reading the output . . . . . . . . . . . . . . . . . . . . . . . . Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Estimates and standard errors . . . . . . . . . . . . . . . . . . Confidence intervals . . . . . . . . . . . . . . . . . . . . . . . . Storing estimation results . . . . . . . . . . . . . . . . . . . . . Reformatting output with estimates table 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 ............ Reformatting output with estout . . . . . . . . . . . . . . . . . Alternative output with listcoef . . . . . . . . . . . . . . . . . Options for types of coefficients . . . . . . . . . . . . . . . . . Options for mlogit, mprobit, and slogit . . . . . . . . . . . . . Other options . . . . . . . . . . . . . . . . . . . . . . . . . . . Standardized coefficients . . . . . . . . . . . . . . . . . . . . . Factor and percent change . . . . . . . . . . . . . . . . . . . . 3.2 3.3 Postestimation analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.1 Wald tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The accumulate option . . . . . . . . . . . . . . . . . . . . . . LR tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Avoiding invalid LR tests . . . . . . . . . . . . . . . . . . . . . 3.3.2 3.4 estat command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5 Measures of fit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 Syntax of fitstat .......................... 104 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Models and measures . . . . . . . . . . . . . . . . . . . . . . . 105 Example of fitstat . . . . . . . . . . . . . . . . . . . . . . . . . 107 Methods and formulas for fitstat . . . . . . . . . . . . . . . . . 108 3.6 Interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 3.6.1 3.6.2 3.6.3 Approaches to interpretation . . . . . . . . . . . . . . . . . . . 116 Predictions using predict . . . . . . . . . . . . . . . . . . . . . 116 Overview of prvalue, prchange, prtab, and prgen Specifying the levels of variables . . . . . . . . 118 . . . . . . . . . . . . . . . . . 118 Options controlling output . . . . . . . . . . . . . . . . . . . . 119 3.6.4 Syntax for prvalue . . . . . . . . . . . . . . . . . . . . . . . . . 120 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Options for confidence intervals . . . . . . . . . . . . . . . . . 120 Options used for bootstrapped confidence intervals 3.6.5 . . . . . . 121 Syntax for prchange . . . . . . . . . . . . . . . . . . . . . . . . 122 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 3.6.6 Syntax for prtab Options . . . . . . . . . . . . . . . . . . . . . . . . . . 122 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 3.6.7 Syntax for prgen . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Options for confidence intervals and marginals . . . . . . . . . 124 Variables generated . . . . . . . . . . . . . . . . . . . . . . . . 124 3.6.8 3.7 3.8 Computing marginal effects using mfx . . . . . . . . . . . . . . 125 Confidence intervals for predictions . . . . . . . . . . . . . . . . . . . . 126 Next steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 I1 Models for Specific Kinds of Outcomes 4 Models for binary outcomes 129 131 4.1 The statistical model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 4.1.1 4.1.2 4.2 A latent-variable model . . . . . . . . . . . . . . . . . . . . . . 132 A nonlinear probability model . . . . . . . . . . . . . . . . . . 135 Variable lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . Specifying the estimation sample . . . . . . . . . . . . . . . . . Weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Estimation using logit and probit . . . . . . . . . . . . . . . . . . . . . 136 136 136 136 137 137 140 140 140 141 142 142 143 143 144 144 145 147 147 151 152 152 152 153 4.2.1 4.3 Observations predicted perfectly . . . . . . . . . . . . . . . . . Hypothesis testing with test and lrtest . . . . . . . . . . . . . . . . . . 4.3.1 Testing individual coefficie1lt.s . . . . . . . . . . . . . . . . . . One- and two-tailed tests ..................... Testing single coefficients using test . . . . . . . . . . . . . . . Testing single coefficients using lrtest . . . . . . . . . . . . . . 4.3.2 Testing multiple coefficients . . . . . . . . . . . . . . . . . . . Testing multiple coefficierits using test . . . . . . . . . . . . . . Testing multiple coefficients using lrtest ............. 4.3.3 4.4 Comparing LR and Wald tests . . . . . . . . . . . . . . . . . . Residuals and influence using predict . . . . . . . . . . . . . . . . . . . 4.4.1 Residuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4.2 4.4.3 Influential cases .......................... Least likely observations . . . . . . . . . . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Options controlling the list of values . . . . . . . . . . . . . . . 4.5 Measurirlg fit 4.5.1 4.5.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Scalar measures of fit using fitstat . . . . . . . . . . . . . . . . 154 Hosmer-Lemeshow statistic . . . . . . . . . . . . . . . . . . . 155 157 4.6 Interpretation using predicted values . . . . . . . . . . . . . . . . . . . 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 Predictfed probabilities with predict . . . . . . . . . . . . . . . 158 Individual predicted probabilities with prvalue . . . . . . . . . 160 Tables of predicted probabilities with prtab . . . . . . . . . . . 162 Graphing predicted probabilities with prgen . . . . . . . . . . 163 Plotting confidence intervals . . . . . . . . . . . . . . . . . . . 166 Changes in predicted probabilities . . . . . . . . . . . . . . . . 168 Marginal change . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Discrete change . . . . . . . . . . . . . . . . . . . . . . . . . . 170 4.7 Interpretation using odds ratios with listcoef . . . . . . . . . . . . . . . Mliltiplicative coefficients . . . . . . . . . . . . . . . . . . . . . 177 179 Effect of the base probability . . . . . . . . . . . . . . . . . . . 179 Percent change in the odds . . . . . . . . . . . . . . . . . . . . 180 4.8 Other commands for binary outcomes . . . . . . . . . . . . . . . . . . . 181 183 5 Models for ordinal outcomes 5.1 The statistical model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.1 5.1.2 5.2 184 A latent-variable model . . . . . . . . . . . . . . . . . . . . . . 184 A nonlinear probability model . . . . . . . . . . . . . . . . . . 187 Variable lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 Estimation using ologit and oprobit . . . . . . . . . . . . . . . . . . . . 188 Specifying the estimation sample . . . . . . . . . . . . . . . . . 188 Weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 5.2.1 5.2.2 Example of attitudes toward working mothers . . . . . . . . . 189 Predicting perfectly . . . . . . . . . . . . . . . . . . . . . . . . 192 5.3 Hypothesis testing with test and lrtest 5.3.1 5.3.2 Testing individual coefficients .................. .................. Testing multiple coefficients . . . . . . . . . . . . . . . . . . . 5.4 5.5 5.6 5.7 5.8 Scalar measures of fit using fitstat . . . . . . . . . . . . . . . . . . . . . Converting to a different parameterization* . . . . . . . . . . . . . . . . The parallel regression assumption .................... Residuals and outliers using predict . . . . . . . . . . . . . . . . . . . . 5.8.1 5.8.2 5.8.3 5.8.4 5.8.5 Marginal change in y* . . . . . . . . . . . . . . . . . . . . . . . Predicted probabilities Interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...................... Predicted probabilities with predict . . . . . . . . . . . . . . . Individual predicted probabilities with prvalue Tables of predicted probabilities with prtab ......... ........... 5.8.6 5.8.7 Graphing predicted probabilities with prgen . . . . . . . . . . Changes in predicted probabilities Marginal change with prchange Marginal change with mfx ................ . . . . . . . . . . . . . . . . . .................... Discrete change with prchange . . . . . . . . . . . . . . . . . . Confidence intervals for discrete changes . . . . . . . . . . . . Computing discrete change for a 10-year increase in age . . . . 5.9 ..................... Less common models for ordinal outcomes . . . . . . . . . . . . . . . . 5.9.1 The stereotype model . . . . . . . . . . . . . . . . . . . . . . . 5.8.8 Odds ratios using listcoef 5.9.2 5.9.3 The generalized ordered logit model . . . . . . . . . . . . . . . The continuation ratio model ................... 223 6 Models for nominal outcomes with case-specific data 6.1 The multinomial logit model 6.1.1 . . . . . . . . . . . . . . . . . . . . . . . . 224 Formal statement of the model . . . . . . . . . . . . . . . . . . 227 6.2 Estimation using mlogit Variable lists .......................... ............................ ................ Weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Specifying the estimation sample . 6.2.1 6.2.2 6.2.3 6.3 Example of occupational attainment . . . . . . . . . . . . . . . Using different base categories . . . . . . . . . . . . . . . . . . Predicting perfectly ........................ Hypothesis testing of coefficients . . . . . . . . . . . . . . . . . . . . . . 6.3.1 mlogtest for tests of the MNLM . . . . . . . . . . . . . . . . . Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3.2 Testing the effects of the independent variables ......... A likelihood-ratio test . . . . . . . . . . . . . . . . . . . . . . . A Wald test ............................ Testing multiple independent variables ............. 6.3.3 Tests for co~nbining alternatives . . . . . . . . . . . . . . . . . A Wald test for combining alternatives . . . . . . . . . . . . . Using test [category]* . . . . . . . . . . . . . . . . . . . . . . . An LR test for combining alt,erna.tives . . . . . . . . . . . . . . Using constraint with lrtest* ................... 6.4 Independence of irrelevant alternatives . . . . . . . . . . . . . . . . . . Hausman test of IIA . . . . . . . . . . . . . . . . . . . . . . . Small-Hsiao test of IlA ...................... 6.5 6.6 Measures of fit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6.1 6.6.2 Predicted probabilities . . . . . . . . . . . . . . . . . . . . . . Predicted probabilities with predict . . . . . . . . . . . . . . . Using predict t o compare nilogit and ologit . . . . . . . . . . . 6.6.3 6.6.4 Predicted probabilities and discrete change with prvalue . . . Tables of predicted probabilities with prtab . . . . . . . . . . . 6.6.5 Graphing predicted probabilities with prgen . . . . . . . . . . 250 Plotting probabilities for one outcome and two groups Graphing probabilities for all outcomes for one group ..... ..... 251 252 254 6.6.6 Changes in predicted probabilities . . . . . . . . . . . . . . . . Computing marginal and discrete change with prchange . . . . 255 Marginal change with rnfx . . . . . . . . . . . . . . . . . . . . 257 6.6.7 6.6.8 Plotting discrete changes with prchange and mlogview .... 257 Odds ratios using listcoef and mlogview . . . . . . . . . . . . . 260 Listing odds ratios with listcoef . . . . . . . . . . . . . . . . . Plotting odds ratios . . . . . . . . . . . . . . . . . . . . . . . . 261 262 6.6.9 6.6.10 Using mlogplot* . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Plotting estimates from matrices with nrlogploti . . . . . . . . 268 Options for using matrices with mlogplot . . . . . . . . . . . . 269 Global macros and matrices used by mlogplot . . . . . . . . . 269 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7 6.8 Multinomial probit model with IIA . . . . . . . . . . . . . . . . . . . . 270 272 Stereotype logistic regression . . . . . . . . . . . . . . . . . . . . . . . . 277 6.8.1 6.8.2 Formal statement of the one-dimensional SLM FittingtheSLMwithslogit ......... 279 . . . . . . . . . . . . . . . . . . . 280 280 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 6.8.3 6.8.4 6.8.5 6.8.6 Interpretation using predicted probabilities . . . . . . . . . . . 281 Interpretation using odds ratios ................. 283 Distinguishability and the q5 parameters . . . . . . . . . . . . . 286 Ordinality in the one-dimensional SLM . . . . . . . . . . . . . 288 Higher-dimension SLM . . . . . . . . . . . . . . . . . . . . . . 291 7 Models for nominal outcomes with alternative-specific data 7.1 Alternative-specific data organization . . . . . . . . . . . . . . . . . . . 7.1.1 Syntax for case2alt 293 294 . . . . . . . . . . . . . . . . . . . . . . . . 296 7.2 The conditional logit model . . . . . . . . . . . . . . . . . . . . . . . . 7.2.1 Fitting the conditional logit model . . . . . . . . . . . . . . . . Example of the clogit model . . . . . . . . . . . . . . . . . . . 7.2.2 7.2.3 Interpreting odds ratios from clogit . . . . . . . . . . . . . . . Interpreting probabilities from clogit . . . . . . . . . . . . . . Using predict . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using asprvalue . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2.4 Fitting the multinomial logit model using clogit . . . . . . . . Setting up the data with case2alt . . . . . . . . . . . . . . . . Fitting multinomial logit with clogit . . . . . . . . . . . . . . . 7.2.5 Using clogit with case- and alternative-specific variables . . . . Example of a mixed model . . . . . . . . . . . . . . . . . . . . Interpretation of odds ratios using listcoef . . . . . . . . . . . Interpretation of predicted probabilities using asprvalue . . . . Allowing the effects of alternative-specific variables to vary over the alternatives . . . . . . . . . . . . . . . . . . 7.3 Alternative-specific multinomial probit . . . . . . . . . . . . . . . . . . 7.3.1 7.3.2 7.3.3 The model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Informal explanation of estimation by simulation . . . . . . . . Alternative-based data with uncorrelated errors . . . . . . . . Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3.4 7.4 Alternative-based data with correlated errors . . . . . . . . . . The structural covariance matrix ..................... 7.4.1 Interpretation using probabilities ................ Using predict . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using asprvalue . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4.2 Identification, discrete change. and marginal effects . . . . . . Testing for IIA . . . . . . . . . . . . . . . . . . . . . . . . . . . Adding case-specific data 7.4.3 7.4.4 ..................... 7.5 Rank-ordered logistic regression 7.5.1 . . . . . . . . . . . . . . . . . . . . . . 339 Fitting the rank-ordered logit model . . . . . . . . . . . . . . . 341 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 Example of the rank-ordered logit model . . . . . . . . . . . . 342 7.5.2 Interpreting results from rologit . . . . . . . . . . . . . . . . . 343 Interpretation using odds ratios ................. 343 Interpretation using predicted probabilities . . . . . . . . . . . 345 7.6 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 349 8 Models for count outcomes 8.1 The Poisson distribution . . . . . . . . . . . . . . . . . . . . . . . . . . 349 8.1.1 8.1.2 Fitting the Poisson distribution with the poisson command . . 350 Computing predicted probabilities with prcounts . . . . . . . . 352 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 Syntax Variables generated . . . . . . . . . . . . . . . . . . . . . . . . 352 8.1.3 8.2 Comparing observed and predicted counts with prcounts . . . 354 The Poisson regression model . . . . . . . . . . . . . . . . . . . . . . . 356 8.2.1 Fitting the PRM with poisson . . . . . . . . . . . . . . . . . . 357 Variable lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 Specifying the estimation sample . . . . . . . . . . . . . . . . . 358 Weights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 8.2.2 8.2.3 Example of fitting the PRM ................... 358 Interpretation using the rate, p . . . . . . . . . . . . . . . . . 359 Factor change in E(y I x) . . . . . . . . . . . . . . . . . . . . . 359 Percent change in E(y I x) . . . . . . . . . . . . . . . . . . . . 360 Example of factor and percent change . . . . . . . . . . . . . . 360 Marginal change in E(y I x) . . . . . . . . . . . . . . . . . . . 361 Example of marginal change using prchange . . . . . . . . . . 362 Example of marginal change using mfx . . . . . . . . . . . . . 362 Discrete change in E(y I x) . . . . . . . . . . . . . . . . . . . . 362 Example of discrete change using prchange . . . . . . . . . . . 363 Example of discrete change with confidence intervals ..... 364 8.2.4 . . . . . . . . . . . 365 Example of predicted probabilities using prvalue . . . . . . . . 365 Interpretation using predicted probabilities Example of predicted probabilities using prgen . . . . . . . . . 367 Example of predicted probabilities using prcounts 8.3 . . . . . . . 368 8.2.5 Exposure time* . . . . . . . . . . . . . . . . . . . . . . . . . . 370 The negative binomial regression model . . . . . . . . . . . . . . . . . . 372 8.3.1 Fitting the NBRM with nbreg . . . . . . . . . . . . . . . . . . 374 NBl and NB2 variance functions . . . . . . . . . . . . . . . . . 374 8.3.2 Example of fitting the NBRM . . . . . . . . . . . . . . . . . . 375 Comparing the PRM and NBRM using estimates table . . . . 375 8.3.3 8.3.4 8.3.5 8.4 Testing for overdispersion . . . . . . . . . . . . . . . . . . . . . 376 Interpretation using the rate p . . . . . . . . . . . . . . . . . . 377 Interpretation using predicted probabilities . . . . . . . . . . . 378 Models for truncated counts . . . . . . . . . . . . . . . . . . . . . . . . 381 8.4.1 8.4.2 8.4.3 8.4.4 8.4.5 8.5 Fitting zero-truncated models . . . . . . . . . . . . . . . . . . 383 Example of fitting zero-truncated models ............ 383 Interpretation of parameters . . . . . . . . . . . . . . . . . . . 384 Interpretation using predicted probabilities and rates . . . . . 386 Computing predicted rates and probabilities in the estimation sample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 The hurdle regression model* . . . . . . . . . . . . . . . . . . . . . . . 387 8.5.1 8.6 . . . . . . . . . . . 388 8.5.2 Predictions for user-specified values . . . . . . . . . . . . . . . 391 Zero-inflated count models . . . . . . . . . . . . . . . . . . . . . . . . . 394 In-sample predictions for the hurdle model 8.6.1 Fitting zero-inflated models with zinb and zip . . . . . . . . . 396 Variable lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 8.6.2 8.6.3 8.6.4 Example of fitting the ZIP and ZINB models . . . . . . . . . . 397 Interpretation of coefficients . . . . . . . . . . . . . . . . . . . 398 400 Interpretation of predicted probabilities . . . . . . . . . . . . . Predicted probabilities with prvalue . . . . . . . . . . . . . . . 400 Confidence intervals with prvalue . . . . . . . . . . . . . . . . 401 Predicted probabilities with prgen 8.7 ................ 404 Comparisoris among count models . . . . . . . . . . . . . . . . . . . . . 405 8.7.1 8.7.2 Comparing mean probabilities . . . . . . . . . . . . . . . . . . 405 Tests to compare count models . . . . . . . . . . . . . . . . . . 407 LR tests of a . . . . . . . . . . . . . . . . . . . . . . . . . . . Vuong test of nonnested models . . . . . . . . . . . . . . . . . 8.8 Using countfit to compare count models 407 408 409 . . . . . . . . . . . . . . . . . 9 More topics 415 9.1 Ordinal and nominal indeperiderit variables . . . . . . . . . . . . . . . . 415 9.1.1 9.1.2 9.1.3 Coding a categorical independent variable as a set of dummy variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Estimation and interpretation with categorical independent variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Tests with categorical independent variables 415 417 . . . . . . . . . . 418 . . 418 Testing the effect of membership in one category versus the reference category . . . . . . . . . . . . . . . . . . Testing the effect of membership in two nonreference categories 419 Testing that a categorical independent variable has no effect . 420 Testing whether treating an ordinal variable as interval loses information . . . . . . . . . . . . . . . . . . . . . . . 421 9.1.4 Discrete change for categorical independent variables . . . . . 422 Computing discrete change with prchange Computing discrete change with prvalue 9.2 Interactions 9.2.1 . . . . . . . . . . . 422 . . . . . . . . . . . . 423 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 . Computing sex differences in predictions with interactions . 425 9.2.2 9.3 Computing sex differences in discrete change with interactions 426 Nonlinear nonlinear models . . . . . . . . . . . . . . . . . . . . . . . . . 427 9.3.1 9.3.2 9.4 Adding nonlinearities t o linear predictors ............ 428 Discrete change in nonlinear models . . . . . . . . . . . . . . . 429 Using praccum and forvalues t o plot predictions . . . . . . . . . . . . . 430 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 9.4.1 9.4.2 9.4.3 9.4.4 9.4.5 9.4.6 9.4.7 9.5 9.6 Example using age and age-squared Using forvalues with praccum . . . . . . . . . . . . . . . 432 . . . . . . . . . . . . . . . . . . 434 . . . . . . . . . . . . . . 436 Using praccum for graphing a transformed variable . . . . . . 435 Using praccum t o graph interactions IJsing forvalues wit.h prvalue t o crea. e tables . . . . . . . . . . 438 t A more advanced example* . . . . . . . . . . . . . . . . . . . . 441 Using forvalues to create tables with other commands ..... 442 Extending SPost t o other estimation commands . . . . . . . . . . . . . 444 Using Stata more efficiently . . . . . . . . . . . . . . . . . . . . . . . . 444 9.6.1 9.6.2 9.6.3 9.6.4 9.7 profile.do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444 Changing screen fonts and window preferences . . . . . . . . . 446 Using ado-files for changing directories . . . . . . . . . . . . . 446 me.hlp file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 449 A Syntax for SPost commands A.l asprvalue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451 A.2 brant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453 Savedresults . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 A.3 case2alt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 countfit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 Options for specifying the model . . . . . . . . . . . . . . . . . 456 Options to select the models to fit . . . . . . . . . . . . . . . . 456 Options to label and save results . . . . . . . . . . . . . . . . . Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 A.4 Options to control what is printed . . . . . . . . . . . . . . . . 457 457 A.5 fitstat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 Savedresults . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 A.6 leastlikely . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 Options for listing . . . . . . . . . . . . . . . . . . . . . . . . . 462 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 A.7 listcoef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 Options for nominal outcomes Examples . . . . . . . . . . . . . . . . . . 465 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465 Saved results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 A.8 misschk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468 A.9 mlogplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 A.10 inlogtest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473 . Optio~is . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 Saved results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476 Acknowledgment . . . . . . . . . . . . . . . . . . . . . . . . . . 476 A . l l mlogview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 Dialog box controls . . . . . . . . . . . . . . . . . . . . . . . . 477 A.12 Overview of prchange. prgen. prtab. and prvalue . . . . . . . . . . . . . 478 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 A.13 praccum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481 Variables generated . . . . . . . . . . . . . . . . . . . . . . . . 482 A.14 prchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483 483 483 484 A.15 prcounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 Variables generated . . . . . . . . . . . . . . . . . . . . . . . . Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.16 prgen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486 486 487 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488 Options for confidence intervals and marginals . . . . . . . . . 488 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488 Variables generated . . . . . . . . . . . . . . . . . . . . . . . . 489 A.17 prtab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 A.18 prvalue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493 Opt.ions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Options for confidence int.ervals . . . . . . . . . . . . . . . . . Options used for bootstrapped confidence intervals . . . . . . Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Saved result.s . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.19 spex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Exsmplcs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B Description of datasets B.l B.2 B.3 B.4 B.5 B.6 B.7 binlfp2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . couart.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . gsskidvalue2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . nornocc2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ordwarm2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . science2 499 499 500 501 502 503 504 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . travel2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 wlsrnk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507 B.8 References Author index Subject index 509 515
There are no comments for this item.