11.07.2015 Views

[U] User's Guide

[U] User's Guide

[U] User's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

272 [ U ] 20 Estimation and postestimation commandsThe options that may be specified following predict vary according to the estimation commandpreviously used; the predict options are documented along with the estimation command. Forinstance, to discover all the things predict can do following regress, see [R] regress.20.9.1 Using predictThe use of predict is not limited to linear regression. predict can be used after any estimationcommand.Example 7You fit a logistic regression model of whether a car is manufactured outside the United States onthe basis of its weight and mileage rating using either the logistic or the logit command; see[R] logistic and [R] logit. We will use logit.. use http://www.stata-press.com/data/r11/auto. logit foreign weight mpgIteration 0: log likelihood = -45.03321Iteration 1: log likelihood = -29.898968Iteration 2: log likelihood = -27.495771Iteration 3: log likelihood = -27.184006Iteration 4: log likelihood = -27.175166Iteration 5: log likelihood = -27.175156Logistic regression Number of obs = 74LR chi2(2) = 35.72Prob > chi2 = 0.0000Log likelihood = -27.175156 Pseudo R2 = 0.3966foreign Coef. Std. Err. z P>|z| [95% Conf. Interval]weight -.0039067 .0010116 -3.86 0.000 -.0058894 -.001924mpg -.1685869 .0919174 -1.83 0.067 -.3487418 .011568_cons 13.70837 4.518707 3.03 0.002 4.851864 22.56487After logit, predict without options calculates the probability of a positive outcome (we learnedthat by looking at [R] logit). To obtain the predicted probabilities that each car is manufactured outsidethe United States, we type. predict probhat(option pr assumed; Pr(foreign)). summarize probhatVariable Obs Mean Std. Dev. Min Maxprobhat 74 .2972973 .3052979 .000729 .8980594. list make mpg weight foreign probhat in 1/5make mpg weight foreign probhat1. AMC Concord 22 2,930 Domestic .19043632. AMC Pacer 17 3,350 Domestic .09577673. AMC Spirit 22 2,640 Domestic .42208154. Buick Century 20 3,250 Domestic .08626255. Buick Electra 15 4,080 Domestic .0084948

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!