I'm running Stata 15 on OSX and working with panel data. My goal is to test and compare the effects of an attitudinal measure ('srZ16_mean' in the output below) on two different but identically scaled dependent variables (i.e. 0-100 feeling thermometers that correspond to different social groups; ftpoorwhmen and ftpoorblkmen in the output below).
While I know how obtain the predicted margins for each model separately:
Code:
. regress ftpoorblkmen srZ16_mean if white==1 & year==2019 [pweight= weight_2019], cluster(inputstate2_2019 > ) (sum of wgt is 842.8974449260362) Linear regression Number of obs = 1,072 F(1, 49) = 16.90 Prob > F = 0.0001 R-squared = 0.0296 Root MSE = 23.686 (Std. Err. adjusted for 50 clusters in inputstate2_2019) ------------------------------------------------------------------------------ | Robust ftpoorblkmen | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- srZ16_mean | -4.418421 1.07468 -4.11 0.000 -6.57807 -2.258771 _cons | 59.5167 .9704558 61.33 0.000 57.56649 61.4669 ------------------------------------------------------------------------------ . margins, at(srZ16_mean=(-1.77 -1 0 1 1.21)) Adjusted predictions Number of obs = 1,072 Model VCE : Robust Expression : Linear prediction, predict() 1._at : srZ16_mean = -1.77 2._at : srZ16_mean = -1 3._at : srZ16_mean = 0 4._at : srZ16_mean = 1 5._at : srZ16_mean = 1.21 ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- _at | 1 | 67.3373 1.729827 38.93 0.000 63.86108 70.81352 2 | 63.93512 1.10044 58.10 0.000 61.7237 66.14654 3 | 59.5167 .9704558 61.33 0.000 57.56649 61.4669 4 | 55.09828 1.726984 31.90 0.000 51.62777 58.56878 5 | 54.17041 1.924705 28.14 0.000 50.30257 58.03825 ------------------------------------------------------------------------------ . regress ftpoorwhmen srZ16_mean if white==1 & year==2019 [pweight= weight_2019], cluster(inputstate2_2019) (sum of wgt is 859.4959562645565) Linear regression Number of obs = 1,116 F(1, 50) = 57.20 Prob > F = 0.0000 R-squared = 0.0694 Root MSE = 23.685 (Std. Err. adjusted for 51 clusters in inputstate2_2019) ------------------------------------------------------------------------------ | Robust ftpoorwhmen | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- srZ16_mean | 6.893163 .9114091 7.56 0.000 5.062544 8.723782 _cons | 60.84793 .7649911 79.54 0.000 59.31141 62.38446 ------------------------------------------------------------------------------ . margins, at(srZ16_mean=(-1.77 -1 0 1 1.21)) Adjusted predictions Number of obs = 1,116 Model VCE : Robust Expression : Linear prediction, predict() 1._at : srZ16_mean = -1.77 2._at : srZ16_mean = -1 3._at : srZ16_mean = 0 4._at : srZ16_mean = 1 5._at : srZ16_mean = 1.21 ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- _at | 1 | 48.64704 1.771788 27.46 0.000 45.0883 52.20578 2 | 53.95477 1.178367 45.79 0.000 51.58795 56.32159 3 | 60.84793 .7649911 79.54 0.000 59.31141 62.38446 4 | 67.7411 1.201336 56.39 0.000 65.32814 70.15405 5 | 69.18866 1.354422 51.08 0.000 66.46823 71.9091 ------------------------------------------------------------------------------
Here is some sample data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int(ftpoorwhmen ftpoorblkmen) float srZ16_mean 59 58 1.1724498 59 58 1.1724498 59 58 1.1724498 59 58 1.1724498 59 58 1.1724498 6 55 -1.546768 6 55 -1.546768 6 55 -1.546768 7 7 .992811 7 7 .992811 7 7 .992811 7 7 .992811 7 7 .992811 58 60 .4453181 58 60 .4453181 58 60 .4453181 25 25 .27265695 25 25 .27265695 25 25 .27265695 25 25 .27265695 25 25 .27265695 80 50 .6045231 80 50 .6045231 80 50 .6045231 80 50 .6045231 50 50 -.8324981 50 50 -.8324981 50 50 -.8324981 50 50 -.8324981 74 70 .4383405 74 70 .4383405 74 70 .4383405 74 70 .4383405 74 70 .4383405 72 59 -.10536642 72 59 -.10536642 72 59 -.10536642 72 59 -.10536642 72 59 -.10536642 20 4 .4152141 47 53 -.28500515 47 53 -.28500515 47 53 -.28500515 38 70 1.1724498 38 70 1.1724498 38 70 1.1724498 38 70 1.1724498 38 70 1.1724498 62 43 .992811 62 43 .992811 62 43 .992811 62 43 .992811 62 43 .992811 24 39 -1.1816064 24 39 -1.1816064 24 39 -1.1816064 24 39 -1.1816064 24 39 -1.1816064 100 99 .4152141 100 99 .4152141 100 99 .4152141 100 99 .4152141 100 99 .4152141 76 77 -.49096185 76 77 -.49096185 76 77 -.49096185 76 77 -.49096185 76 77 -.49096185 98 100 -1.546768 98 100 -1.546768 98 100 -1.546768 56 80 -1.0089453 56 80 -1.0089453 56 80 -1.0089453 56 80 -1.0089453 56 80 -1.0089453 46 46 1.1724498 46 46 1.1724498 46 46 1.1724498 46 46 1.1724498 46 46 1.1724498 10 69 1.1724498 10 69 1.1724498 10 69 1.1724498 10 69 1.1724498 10 69 1.1724498 80 78 .634627 80 78 .634627 80 78 .634627 80 78 .634627 80 78 .634627 50 50 .4453181 50 50 .4453181 50 50 .4453181 39 15 .8035021 39 15 .8035021 39 15 .8035021 39 15 .8035021 39 15 .8035021 50 50 -1.736077 end
0 Response to How to compare predicted margins across two separate models?
Post a Comment