I am trying to figure out how to compare predicted probabilities for my model.
First I run an mlogit, my outcome has 3 categories let's say 0,1,2:
.mlogit outcome i.age i.race i.sex , rrr base(0)
Then I run a margins command for all my independent variables, here is age as an example
.margins age, atmeans predict(outcome(0))
.margins age, atmeans predict(outcome(1))
.margins age, atmeans predict(outcome(2))
This is what it looks like, I get one output table for each category of outcome for age
This is the output for pr(outcome(0)):
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age_cat |
18-30 years | .3512348 .0057591 60.99 0.000 .3399472 .3625224
31-50 years | .3730397 .0054785 68.09 0.000 .3623021 .3837773
51-64 years | .403482 .0092394 43.67 0.000 .3853731 .4215909
65+ years | .4673303 .0146504 31.90 0.000 .438616 .4960445
------------------------------------------------------------------------------
This is the output for pr(outcome(1)):
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age_cat |
18-30 years | .0730239 .0024718 29.54 0.000 .0681793 .0778685
31-50 years | .070961 .0023431 30.28 0.000 .0663685 .0755534
51-64 years | .0770021 .0039595 19.45 0.000 .0692416 .0847626
65+ years | .0776246 .005889 13.18 0.000 .0660824 .0891667
------------------------------------------------------------------------------
This is the output for pr(outcome(2)):
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age_cat |
18-30 years | .5757413 .0061909 93.00 0.000 .5636073 .5878753
31-50 years | .5559993 .0058622 94.84 0.000 .5445096 .5674891
51-64 years | .5195159 .0098495 52.75 0.000 .5002113 .5388205
65+ years | .4550452 .0155616 29.24 0.000 .424545 .4855454
Then I also run the margins command to get the overall average predictions for my outcome
. margins
Predictive margins Number of obs = 39,773
Model VCE : Robust
1._predict : Pr(cat0), predict(pr outcome(0))
2._predict : Pr(cat1), predict(pr outcome(1))
3._predict : Pr(cat2), predict(pr outcome(2))
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_predict |
0 | .3804088 .0033258 114.38 0.000 .3738904 .3869272
1 | .0737938 .0014894 49.55 0.000 .0708746 .0767129
2 | .5457974 .003571 152.84 0.000 .5387984 .5527964
------------------------------------------------------------------------------
Now I want to be able to compare the predictions for the categories of age to the average prediction. For example for outcome=0 the average predicted prob is 0.38, but for those age 18-30, the pred prob is 0.35 so the difference is -0.03 or -3%. I would like to be able to do a statistical test to get the significance of this difference, but can't find a way to do it. I thought I could maybe use lincom, but there don't seem to be stored estimates from the mlogit. My goal is to be able to say compared to the average person, those aged-18-30 are more/less likely to be in group outcome=0 and then do this for all my independent vars. Any ideas on how to do this?
Thank you!!
First I run an mlogit, my outcome has 3 categories let's say 0,1,2:
.mlogit outcome i.age i.race i.sex , rrr base(0)
Then I run a margins command for all my independent variables, here is age as an example
.margins age, atmeans predict(outcome(0))
.margins age, atmeans predict(outcome(1))
.margins age, atmeans predict(outcome(2))
This is what it looks like, I get one output table for each category of outcome for age
This is the output for pr(outcome(0)):
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age_cat |
18-30 years | .3512348 .0057591 60.99 0.000 .3399472 .3625224
31-50 years | .3730397 .0054785 68.09 0.000 .3623021 .3837773
51-64 years | .403482 .0092394 43.67 0.000 .3853731 .4215909
65+ years | .4673303 .0146504 31.90 0.000 .438616 .4960445
------------------------------------------------------------------------------
This is the output for pr(outcome(1)):
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age_cat |
18-30 years | .0730239 .0024718 29.54 0.000 .0681793 .0778685
31-50 years | .070961 .0023431 30.28 0.000 .0663685 .0755534
51-64 years | .0770021 .0039595 19.45 0.000 .0692416 .0847626
65+ years | .0776246 .005889 13.18 0.000 .0660824 .0891667
------------------------------------------------------------------------------
This is the output for pr(outcome(2)):
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age_cat |
18-30 years | .5757413 .0061909 93.00 0.000 .5636073 .5878753
31-50 years | .5559993 .0058622 94.84 0.000 .5445096 .5674891
51-64 years | .5195159 .0098495 52.75 0.000 .5002113 .5388205
65+ years | .4550452 .0155616 29.24 0.000 .424545 .4855454
Then I also run the margins command to get the overall average predictions for my outcome
. margins
Predictive margins Number of obs = 39,773
Model VCE : Robust
1._predict : Pr(cat0), predict(pr outcome(0))
2._predict : Pr(cat1), predict(pr outcome(1))
3._predict : Pr(cat2), predict(pr outcome(2))
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_predict |
0 | .3804088 .0033258 114.38 0.000 .3738904 .3869272
1 | .0737938 .0014894 49.55 0.000 .0708746 .0767129
2 | .5457974 .003571 152.84 0.000 .5387984 .5527964
------------------------------------------------------------------------------
Now I want to be able to compare the predictions for the categories of age to the average prediction. For example for outcome=0 the average predicted prob is 0.38, but for those age 18-30, the pred prob is 0.35 so the difference is -0.03 or -3%. I would like to be able to do a statistical test to get the significance of this difference, but can't find a way to do it. I thought I could maybe use lincom, but there don't seem to be stored estimates from the mlogit. My goal is to be able to say compared to the average person, those aged-18-30 are more/less likely to be in group outcome=0 and then do this for all my independent vars. Any ideas on how to do this?
Thank you!!
