Hi I have a simple binary logistic regression model I would like to test on an independent dataset. How do i go about testing wether it categorizes my outcome variable successfuly in the independent dataset.
Thank you
Thank you
. use "https://www.stata-press.com/data/r17/auto.dta"
(1978 automobile data)
. logistic foreign mpg
Logistic regression Number of obs = 74
LR chi2(1) = 11.49
Prob > chi2 = 0.0007
Log likelihood = -39.28864 Pseudo R2 = 0.1276
------------------------------------------------------------------------------
foreign | Odds ratio Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
mpg | 1.173232 .0616975 3.04 0.002 1.05833 1.300608
_cons | .0125396 .0151891 -3.62 0.000 .0011674 .1346911
------------------------------------------------------------------------------
Note: _cons estimates baseline odds.
. predict pr_positive_outcome, p
. list foreign mpg pr_positive_outcome in 1/10
+---------------------------+
| foreign mpg pr_pos~e |
|---------------------------|
1. | Domestic 22 .2964837 |
2. | Domestic 17 .1593718 |
3. | Domestic 22 .2964837 |
4. | Domestic 20 .2344013 |
5. | Domestic 15 .1210596 |
|---------------------------|
6. | Domestic 18 .1819565 |
7. | Domestic 26 .4439737 |
8. | Domestic 20 .2344013 |
9. | Domestic 16 .1391136 |
10. | Domestic 19 .2069539 |
+---------------------------+
.
Comment