Hi,

I am having trouble interpreting the results of my logistic regression analysis.

I am running an exploratory analysis using stepwise regression (I understand this method has limitations) including categorical variables as follows:

Code:
xi: stepwise, pr(0.2): logistic outcome (i.nationality) gender age (i.medications) (i.quality)
I reran the final model without using stepwise regression (ie, input all the variables that are retained in the model), with either of the following:

Code:
logistic outcome i.nationality i.quality
logistic outcome _Inationali_2 _Inationali_3 _Inationali_4 _Iquality_2 _Iquality_3
The results of these final two regressions are identical, but these differ slightly than the stepwise regression results. The number of observations retained in the stepwise analyses is reduced.

I am having trouble understand the mathematics/reasons behind these models providing different results. Could anyone help with this? I am using Stata 14.2 & have included my data below.

Thank you in advance for any advice,
Bryony


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(outcome nationality) byte gender float(age age_cat medications    quality)
0 1 1   43 2 6 2
1 2 1   32 1 4 2
0 2 0 39.5 1 6 1
0 1 0   41 2 4 1
0 1 0 32.5 1 3 1
0 1 1 24.5 1 2 1
0 3 0   35 1 3 1
0 2 0 36.5 1 4 2
0 1 1   39 1 3 2
0 2 0   44 2 1 2
1 2 0 26.5 1 2 2
. 1 0 47.5 2 3 1
0 1 0   37 1 6 1
. 1 0 52.5 3 1 1
. 1 0 36.5 1 1 2
. 2 0   42 2 3 3
0 1 0   53 3 5 1
0 4 0   32 1 2 1
1 1 0   52 3 6 3
. 1 0 35.5 1 1 1
. 1 0   27 1 4 1
0 2 0   42 2 1 1
0 2 0   39 1 1 1
0 2 0 47.5 2 4 3
. 1 0 40.5 2 1 3
. 2 0   42 2 6 .
0 2 0   40 1 2 2
0 1 0   40 1 4 1
0 1 1   28 1 3 3
0 2 0   37 1 6 1
1 1 0    . . 1 3
0 1 0 34.5 1 4 2
0 2 0   28 1 3 1
0 1 1 28.5 1 4 1
0 1 0   56 3 4 1
0 4 0   43 2 3 2
0 1 0 38.5 1 4 1
0 1 0 60.5 3 3 2
0 1 0   46 2 1 1
0 1 0   44 2 2 2
. 1 0 55.5 3 2 1
0 1 0   35 1 5 1
0 1 1   32 1 3 3
0 4 0   39 1 3 1
. 2 0   46 2 5 1
0 2 0   36 1 4 1
1 4 0 55.5 3 5 .
0 4 0 28.5 1 3 1
1 1 1   55 3 1 1
1 1 0   34 1 4 2
1 1 0 65.5 3 1 .
1 1 0   55 3 4 3
. 2 0 33.5 1 1 2
0 1 0 42.5 2 1 1
0 2 0   40 2 4 2
0 2 0 27.5 1 1 1
0 2 0 22.5 1 6 3
. 1 0 45.5 2 4 1
1 1 0   50 2 1 1
0 1 0 48.5 2 5 2
0 1 0 42.5 2 6 2
0 2 0 51.5 3 3 1
. 3 0   43 2 1 1
0 2 0 30.5 1 4 1
0 4 0   47 2 3 2
0 2 0 36.5 1 1 1
0 2 0   52 3 4 2
0 2 0   35 1 1 1
0 2 0 35.5 1 5 3
1 1 1   48 2 2 2
0 1 0 25.5 1 2 1
. 1 0   45 2 4 2
. 1 0 47.5 2 5 1
. 1 0 49.5 2 3 1
1 4 0 35.5 1 2 3
0 1 0 30.5 1 4 3
0 1 0   47 2 2 1
. 2 0 36.5 1 4 1
. 1 0 55.5 3 3 1
. 2 0 40.5 2 2 2
. 1 0   38 1 4 2
0 2 1 25.5 1 4 3
. 1 0 60.5 3 2 1
. 1 0 29.5 1 3 1
0 2 0 50.5 3 5 1
. 1 0   32 1 2 2
. 1 0 30.5 1 4 1
0 1 0    . . 1 1
. 1 0 28.5 1 3 2
. 1 0 26.5 1 3 1
0 2 0 44.5 2 2 1
. 2 0 38.5 1 4 3
0 2 0    . . 2 1
1 3 0 42.5 2 4 2
1 1 1   32 1 4 3
. 2 0   30 1 6 2
. 2 0   34 1 5 2
1 2 1 30.5 1 1 3
. 2 0   32 1 3 1
. 2 0 40.5 2 2 1
end