I would like to use margins in a similar way as we can use predict after regression (e.g. predict yhat, xb). I know that before margins function we had the "adjust" that allowed to do so, but it does not work well with what I want to do. I also saw a post previously but it also does not seem to work for me. I have OLS regression and would like to see how the predictions change for different income deciles. I want to use margins to predict more accurately EF_food for missing values in dataset_id=USS and I was hoping that if I include income deciles I can obtain more accurate predictions.
Thanks in advance!
Code:
reg EF_food j_fihhmngrs_dv i.j_nkids015 i.owned_outright i.owned_outright i.non_white if dataset_id==0 [aweight=weighta] margins, over ( decile_USS_LCF)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(dataset_id EF_food) double j_fihhmngrs_dv float(j_nkids015 owned_outright non_white) double weighta float decile_USS_LCF 0 .7816824 826.0210571289063 0 0 0 11.83271786805351 1 0 3.66914 678.81982421875 0 1 0 2.333911690268645 1 0 9.756257 3064.186767578125 0 0 0 5.35219072413753 6 0 6.830635 4587.7001953125 0 0 0 8.620880305885088 8 0 13.15235 1337.4217529296875 0 1 0 6.508487471455665 2 0 2.003386 710.8319702148438 0 0 0 1.8111698165541175 1 0 3.253308 962.9521484375 0 0 0 2.7187062059916376 1 0 1.6621974 1602.163330078125 0 0 0 6.493507280305288 3 0 2.3308797 10117.7265625 0 0 0 7.061185763740903 10 0 9.121844 1096.9320068359375 0 0 0 7.241820829276195 1 0 11.114388 8800.2197265625 0 0 0 6.249359886951974 10 0 5.827403 863.0203857421875 0 0 0 3.9520102141043005 1 0 15.954617 1696.17138671875 0 0 0 4.4385118413355125 3 0 3.818949 5895.45654296875 0 0 0 5.081123604047845 9 0 2.501838 849.511474609375 0 0 0 5.980489477011162 1 0 2.9492335 1278.5965576171875 0 0 0 6.4580342551338825 2 0 3.628804 324.4366760253906 0 0 0 4.821034487344665 1 0 .36062685 5522.05322265625 0 0 0 7.0857207016562676 8 0 5.795914 3971.110107421875 1 0 0 4.280514643245957 7 0 3.158304 2242.811279296875 0 0 0 2.0613489931909776 4 0 8.033847 1787.9705810546875 0 0 0 4.2769254887038874 3 0 12.100324 2700.04736328125 0 0 0 4.48452865950731 5 0 2.3342412 2328.28564453125 0 0 0 3.4258469310716726 4 0 .5865059 1103.3726806640625 0 0 0 2.8930818114269825 1 0 .25883174 1493.4503173828125 0 0 0 11.224903063313976 2 0 6.993412 2327.086669921875 0 0 0 4.809965179497527 4 0 4.513049 2555.2958984375 0 1 0 4.88047136833043 5 0 6.761583 854.72314453125 0 0 0 5.183871721416855 1 0 9.515974 1536.6866455078125 0 1 0 5.690553732551048 2 0 2.787873 1831.7501220703125 0 0 0 6.19311367148626 3 0 12.202604 403.0086669921875 0 0 0 3.493125463869895 1 0 7.578351 2685.490966796875 0 0 0 5.622038753169735 5 0 3.6461945 1073.587646484375 0 0 0 2.169663514453735 1 0 6.538309 2305.312255859375 0 0 0 6.00395526669353 4 0 9.844992 1038.5703125 0 0 0 2.316906265114321 1 0 9.886992 1694.618896484375 0 0 0 5.269973837753337 3 0 3.84432 6867.943359375 0 0 0 9.097116285030578 9 0 .7494648 1122.04931640625 0 0 0 2.366565116606875 1 0 17.791197 2305.0810546875 0 0 0 2.423740469692785 4 0 4.813661 1963.1041259765625 0 0 0 3.4612991347916426 3 0 7.142865 1829.5869140625 0 1 0 3.01800853863535 3 0 15.94225 6244.5498046875 2 0 0 6.173815626085214 9 0 9.190422 3265.743896484375 0 1 0 3.9502903418757374 6 0 8.352653 778.81103515625 0 1 0 5.24925204529951 1 0 3.105875 2597.5439453125 0 0 0 9.037633229860162 5 0 4.0008373 1989.6500244140625 0 0 0 2.4543373675936926 4 0 8.984796 4685.72021484375 0 0 0 4.961643893675633 8 0 9.126013 2158.043212890625 0 0 0 5.6670980004740175 4 0 19.442034 1924.17333984375 0 0 0 4.312050181919328 3 0 6.700543 3447.25341796875 0 1 0 4.129980354960195 6 0 3.018616 1062.580078125 0 0 0 6.84168868164691 1 0 14.819835 6125.51318359375 0 0 0 2.011365562753375 9 0 4.0069394 1052.9317626953125 0 0 0 9.189508761274693 1 0 1.823555 1839.066650390625 0 0 0 4.7651286699287025 3 0 21.92558 2613.78662109375 1 0 0 5.652018818139457 5 0 7.694699 2248.69677734375 3 0 1 4.1114755811064025 4 0 13.173983 3690.43994140625 0 0 1 3.9597450341387823 7 0 6.350592 4685.2001953125 0 0 1 9.34250509649158 8 0 17.173487 1841.6666259765625 3 0 1 5.097459516742985 3 0 24.291676 0 0 0 1 7.8130770219866 1 0 3.764162 2448.376708984375 0 0 1 7.998285143734138 5 0 1.4949176 10790.5634765625 0 0 1 7.42569770840796 10 1 . 680.3300170898438 0 1 0 . 1 1 . 916.6699829101563 0 0 0 . 1 1 . 3476.669921875 0 1 0 . 7 1 . 3500 0 0 0 . 7 1 . 11920.490234375 0 0 0 . 10 1 . 320.6700134277344 0 0 0 . 1 1 . 2263.340087890625 0 0 0 . 5 1 . 2274.969970703125 0 0 0 . 5 1 . 16984.759765625 0 1 0 . 10 1 . 6367.16015625 0 0 0 . 9 1 . 1120.1800537109375 0 0 0 . 2 1 . 1543.8399658203125 0 1 0 . 3 1 . 8027.60009765625 0 0 0 . 10 1 . 2166.669921875 0 0 0 . 4 1 . 982.52001953125 0 0 0 . 1 1 . 3370.830078125 0 0 0 . 7 1 . 908.5800170898438 0 0 0 . 1 1 . 640 0 1 0 . 1 1 . 3643.7900390625 0 0 0 . 7 1 . 3302.43994140625 0 0 0 . 6 1 . 4699.89990234375 0 0 0 . 8 1 . 1493.050048828125 0 0 0 . 3 1 . 2116.489990234375 0 1 0 . 4 1 . 1986.030029296875 2 0 0 . 4 1 . 650 0 1 0 . 1 1 . 5511.39013671875 0 0 0 . 9 1 . 8550.6796875 1 0 0 . 10 1 . 5242.43994140625 2 0 0 . 9 1 . 1934.6700439453125 0 0 0 . 4 1 . 2074.8701171875 2 0 0 . 4 1 . 5512.97021484375 0 0 0 . 9 1 . 5693.97021484375 2 0 0 . 9 1 . 859 0 0 0 . 1 1 . 4658.6201171875 0 1 0 . 8 1 . 2148.8701171875 0 0 0 . 4 1 . 518.9199829101563 0 0 0 . 1 1 . 2101.669921875 0 0 0 . 4 1 . 6651.25 0 1 0 . 9 end label values dataset_id dataset_id label def dataset_id 0 "LCF", modify label def dataset_id 1 "USS", modify label values j_fihhmngrs_dv j_fihhmngrs_dv
0 Response to Generating predict after margins
Post a Comment