I have a pooled dataset of 16 countries and I want to estimate hierarchical linear models (HLMs) at both individual and country levels. In fact, I want to answer this question to what extent is the within country positive association between household wealth and health (previous studies have found that individuals with higher wealth tend to be healthier than their counterparts with lower wealth) systematically associated with country’s social public spending. At the individual level, I have age (in years), gender, education and household wealth. At the country level, I have public social spending taken from OECD statistics.
I would be highly appreciated it if anyone can provide me with examples of HLM Stata commands to get what I am looking for.
Note: health (the outcome) is measured as a continuous variable. A higher score indicates better health.
Data example
Code:
clear input float id int age byte gender double hhwealth byte health float wgt byte eduisced float(country pub_spending) 2879 70 1 40000000 9 48710.69 1 1 18.7 23895 63 1 373787.8503531132 6 3546.172 1 7 24.9 30161 51 0 181999.99999999988 12 1673.2848 2 5 20.1 34048 71 1 14067.470341340759 10 788.149 1 4 27.3 16214 78 0 427109.98562707653 3 9366.743 2 8 28.4 19583 84 0 127703.39063640917 8 1383.8003 1 10 21.3 15085 64 0 240600.00000000015 5 3812.075 1 6 21.6 2258 52 0 1.120e+08 10 223469.55 3 1 18.7 29275 74 1 265756.71380039497 3 3470.153 1 5 20.1 15590 54 1 719505.0160481693 10 7076.578 1 6 21.6 14452 80 0 77999.99999999994 7 7832.498 1 6 21.6 20589 68 1 149999.99999999994 9 1165.6177 1 10 21.3 23063 64 0 1735500.0000000002 8 1825.4928 2 16 16.3 2960 60 0 494999.99999999994 13 1111.0873 2 12 26.3 24995 83 0 94999.99999999997 6 8814.65 1 7 24.9 8903 65 0 85701.06562441346 11 14581.536 2 3 25.2 31090 54 1 -5400 5 3292.555 2 5 20.1 4359 70 1 5308.860824866152 10 6248.625 2 14 18.8 33915 67 1 262757.8718783931 18 846.3412 1 4 27.3 31041 63 1 1016.2506756859175 8 3058.406 1 5 20.1 23175 51 0 102200.00001000002 9 20083.873 2 7 24.9 9476 55 1 72150.00000000001 8 6282.493 2 3 25.2 3482 52 1 0 9 150204 2 1 18.7 32216 64 1 25994.281258123225 3 3595.019 1 15 19.8 18160 55 0 234499.99999999985 7 9598.058 1 8 28.4 35000 51 1 41259.50054288811 15 1216.0372 3 4 27.3 14658 66 0 1007482.0741800852 3 7482.219 2 6 21.6 5452 54 1 41272.37044387198 9 1269.3214 2 14 18.8 10422 53 0 30000.000010000007 11 22395.434 2 3 25.2 33568 64 1 181.9599688068625 13 3595.019 2 15 19.8 20215 64 0 11999.999999999993 6 1346.919 3 10 21.3 4349 73 1 6360.293364404239 11 733.8794 3 14 18.8 17743 52 1 497115.46692906856 14 7638.583 3 8 28.4 331 63 0 30000000 11 103813.77 1 1 18.7 17820 61 0 100839.99999999994 10 8231.469 1 8 28.4 4328 59 1 1189.0617712417074 4 287.29907 1 14 18.8 23202 66 0 1564973.4593376894 10 4448.4897 3 7 24.9 16052 57 0 -1000.0000000000005 7 4025.007 2 8 28.4 36269 58 1 166449.51140065148 8 853.4917 2 4 27.3 33939 65 0 172638.43648208462 13 773.7526 1 4 27.3 22570 51 0 895000.0000000005 10 1726.6412 3 16 16.3 27694 73 1 56059.31663356286 6 610.5958 1 13 15.5 23401 60 1 9999.999999999996 5 5560.611 1 7 24.9 719 56 1 164999.99999999994 12 2821.484 3 2 26.4 4876 75 1 149662.28226093136 9 6248.625 1 14 18.8 434 70 1 50100.00000000001 4 2127.1228 1 2 26.4 1465 52 1 156516.72256769452 9 1724.0332 1 12 26.3 31821 82 1 5198.856251624639 8 6697.385 1 15 19.8 5933 83 1 37808.55632917324 10 6132.176 2 14 18.8 26602 57 0 175337.18689788063 7 2420.2878 1 13 15.5 693 52 1 76999.99999999996 11 2649.008 3 2 26.4 3207 59 1 401517.49751720147 7 1036.4684 1 12 26.3 12096 64 0 312338.43150611164 12 464.9221 3 9 26 14321 52 1 581100.0000000001 7 1960.365 1 6 21.6 5384 83 1 57589.76182012089 4 807.5251 1 14 18.8 33661 60 0 -7600.434310532014 4 953.993 1 4 27.3 35791 63 0 381541.802388708 7 949.8943 1 4 27.3 29346 65 0 124000 11 3524.253 1 5 20.1 30689 76 1 205325.99641428527 7 1805.887 1 5 20.1 5864 63 1 30501.24422324917 9 194.16245 2 14 18.8 25759 71 1 71853.42510851481 7 13147.083 1 7 24.9 26108 63 0 286999.9999999998 20 8570.46 1 7 24.9 10958 56 1 301336.6590034285 12 4976.016 3 3 25.2 2730 51 1 20000000 10 150204 2 1 18.7 21484 54 1 115000.00000000001 7 816.9242 2 10 21.3 7278 92 0 43183.2202344232 5 661.5779 3 11 18.5 1824 62 1 1.000e+08 12 303252.88 2 1 18.7 34288 54 1 33893.11378635236 13 1934.717 3 4 27.3 15821 64 1 1311299.7032007866 10 5233.971 1 6 21.6 19434 53 1 999.9999999999418 14 1002.6748 2 10 21.3 19187 56 0 356538.640908083 12 959.1287 3 10 21.3 19116 67 0 156186.8875180382 11 1362.4943 1 10 21.3 19917 57 1 52213.50186968627 5 844.6171 1 10 21.3 5188 59 0 66263.77532883042 13 1084.6837 1 14 18.8 2840 64 1 10000000 14 85678.51 1 1 18.7 30747 79 1 44000.00000000001 8 3342.135 1 5 20.1 10346 60 0 134000.00000000006 12 7578.946 2 3 25.2 35213 50 1 157715.09567939996 12 1143.8939 1 4 27.3 20916 55 1 0 11 1039.009 1 10 21.3 5829 64 1 5581.230003554921 12 417.7658 2 14 18.8 2168 62 0 178496.16311992746 6 1044.0209 2 12 26.3 2879 62 1 2646694.659872894 2 1081.991 1 12 26.3 5910 59 1 38037.6821898329 12 1981.7465 2 14 18.8 35474 82 0 219489.68512486434 8 861.1288 1 4 27.3 28632 69 1 2507.1161335363377 4 2970.543 1 5 20.1 35958 58 1 621346.125640214 11 972.01 2 4 27.3 5981 74 0 0 11 690.1843 3 14 18.8 5895 74 0 1066.4770707429789 9 208.3875 2 14 18.8 7779 63 0 1037356.4380710504 11 912.1061 1 11 18.5 24731 72 1 432650.1709280959 9 10527.044 1 7 24.9 2069 73 0 1.000e+08 8 307214.78 2 1 18.7 10576 77 0 257741.87081571564 10 12098.02 2 3 25.2 13354 57 0 261744.96644295292 10 1034.2709 2 9 26 7023 59 0 635410.2405922266 8 2163.05 3 11 18.5 8850 67 0 173590.63340386067 10 6695.558 2 3 25.2 3632 68 0 545000.0000000001 18 1129.0242 3 12 26.3 28247 58 0 578.0346820809247 5 742.8597 2 13 15.5 16587 79 1 188013.86109267097 9 8852.361 2 8 28.4 28760 61 0 3000 10 1790.3823 1 5 20.1 21560 68 1 182985.6150324553 8 1412.1522 1 10 21.3 32518 62 1 0 8 3583.1255 1 15 19.8 17073 54 1 308896.9639211485 9 7638.583 2 8 28.4 19234 58 1 250000.00000000006 7 844.6171 1 10 21.3 35672 61 1 285954.62428329926 13 809.0324 2 4 27.3 2084 57 0 39500.00000000003 6 1046.6176 1 12 26.3 33618 56 1 76472.1895841861 12 5531.928 2 15 19.8 16435 65 0 10999.999999999995 12 4775.7837 1 8 28.4 29842 57 1 314000.00000000006 12 1600.0568 3 5 20.1 17821 60 1 100839.99999999994 8 6990.924 1 8 28.4 1419 64 1 80000000 14 59266.4 2 1 18.7 555 67 0 140860.21600975975 8 2190.0513 3 2 26.4 14611 76 1 105320.49929844591 3 4975.213 1 6 21.6 3438 65 1 0 9 106122.44 1 1 18.7 10449 56 1 11076.67490422706 8 6282.493 2 3 25.2 34723 73 1 3484.575463201457 2 969.6494 1 4 27.3 5048 58 1 25863.469195585065 7 1053.4093 1 14 18.8 35294 50 1 -59384.914827408604 7 1270.731 1 4 27.3 7497 55 0 309685.3793954349 7 2203.2693 2 11 18.5 27603 55 0 215054.8425410812 15 803.7437 3 13 15.5 33464 68 1 53548.21939173385 6 3583.1255 1 15 19.8 34120 66 1 139730.43761208604 7 765.6265 1 4 27.3 33468 68 1 52768.39095399015 6 3194.11 2 15 19.8 198 69 0 50000000 7 48351.27 1 1 18.7 21818 54 1 89075.09621848028 5 1066.3801 2 10 21.3 2747 63 0 16500.000000000007 10 1093.1294 3 12 26.3 16662 60 1 335493.956050493 8 6458.885 1 8 28.4 21644 67 1 240715.76695107706 7 1195.297 2 10 21.3 33259 51 1 -6108.656095658959 12 11093.976 2 15 19.8 33593 72 1 0 10 11406.537 1 15 19.8 8802 72 0 1010999.9999999994 7 6460.054 3 3 25.2 35623 60 0 226927.2529858848 12 920.0164 2 4 27.3 17048 74 0 679446.9441982805 8 6767.038 3 8 28.4 9671 53 0 187000.0000000001 11 13048.358 3 3 25.2 18659 76 1 3384.7019489069035 5 5332.353 1 8 28.4 19123 56 1 502999.9999999999 13 728.2668 2 10 21.3 19065 58 0 139999.99999999994 9 972.9957 3 10 21.3 2208 64 1 7200000 10 55263.38 1 1 18.7 29824 59 1 .000010000000000065512 5 2410.735 1 5 20.1 2710 58 1 113569.74617920628 8 1060.0547 1 12 26.3 34710 80 0 99782.8447339848 5 793.397 1 4 27.3 16259 57 0 241499.99999999994 11 6980.34 2 8 28.4 18372 59 0 182721.19618177152 9 8461.269 3 8 28.4 15946 58 1 111202.63887600691 10 6896.376 2 8 28.4 16655 67 0 728819.091688752 10 6844.206 1 8 28.4 21537 64 1 168223.06550267854 6 1224.5327 1 10 21.3 17594 54 0 200580.5134948471 7 10443.597 1 8 28.4 1390 53 1 24000000 12 51209.68 3 1 18.7 522 58 1 151244.88531138076 10 2649.008 3 2 26.4 23791 68 1 -10.89265409869438 6 3530.619 1 7 24.9 19799 59 1 42000 9 844.6171 1 10 21.3 21375 57 0 246544.0792970508 12 940.5347 3 10 21.3 3627 68 0 40000000 11 234160.88 2 1 18.7 14298 64 1 110682.96922029518 5 11249.63 3 6 21.6 24502 96 0 200000.00000000006 1 24408.06 1 7 24.9 27503 57 0 1075457.4205054608 18 666.9362 3 13 15.5 25741 59 1 0 6 7154.852 1 7 24.9 20265 83 0 218500.00000000006 11 1798.1694 1 10 21.3 26438 75 1 485607.9752873098 8 610.5958 3 13 15.5 9147 68 0 204557.17578624905 11 9073.204 2 3 25.2 12286 67 0 249664.42953020125 9 722.5031 1 9 26 20312 61 0 430000.0000000001 8 1394.091 1 10 21.3 1936 53 0 13.94085570876437 9 1046.152 3 12 26.3 27405 67 0 135163.77649325633 7 467.1416 2 13 15.5 17858 58 0 241499.99999999983 8 5126.601 2 8 28.4 11558 67 1 204668.6272134847 14 701.1609 2 9 26 1825 51 1 344513.27782006585 9 1289.9788 1 12 26.3 28569 68 1 408237.86106877995 5 1435.2042 1 5 20.1 1111 74 1 15000.000000000005 9 1219.694 1 12 26.3 3956 69 0 772999.9999999998 6 1116.3104 1 12 26.3 9231 56 1 146290.62991615926 14 7256.202 3 3 25.2 34219 71 1 52399.33627069346 8 1012.072 3 4 27.3 5232 86 1 0 4 2538.4004 1 14 18.8 3546 59 0 14000000 17 350396.2 3 1 18.7 2869 61 0 567499.9999999999 10 1106.6073 1 12 26.3 29843 70 1 174255.9719279125 10 1313.7986 1 5 20.1 3959 81 1 385426.75376292766 4 1495.469 1 12 26.3 26006 61 1 300650.2211610048 4 3182.541 1 7 24.9 9785 64 1 15000.000000000005 12 14868.004 2 3 25.2 33977 57 0 289902.2801302932 13 1209.0172 3 4 27.3 1238 73 1 40000000 6 349492.7 2 1 18.7 23185 58 1 299999.9999999998 12 9567.156 2 7 24.9 32430 60 1 21565.11621280637 11 2652.093 2 15 19.8 8009 69 0 55521.2831585441 8 1823.469 2 11 18.5 18597 61 1 724399.7598295531 13 4652.165 3 8 28.4 16825 76 1 2792.2399299875174 2 5061.079 1 8 28.4 30716 61 0 157999.99999999994 12 1769.377 2 5 20.1 26022 54 0 598000.0000099998 12 9880.681 1 7 24.9 30107 52 1 180564.4400021827 10 1214.8057 3 5 20.1 19399 82 0 79999.99999999994 0 1291.6865 1 10 21.3 35811 56 1 672865.2830570552 14 1583.106 2 4 27.3 9075 62 1 11000.000000000004 8 7473.003 3 3 25.2 23056 52 1 372650.0000000001 17 1627.1653 3 16 16.3 11910 67 0 130872.48322147655 10 930.1123 1 9 26 35972 74 0 32030.401737242126 7 871.9657 1 4 27.3 9706 66 0 2999.9999999999973 7 13364.912 3 3 25.2 33779 60 1 262757.87187839305 10 734.1823 1 4 27.3 27051 59 1 97411.57071785098 7 451.8449 2 13 15.5 34605 62 0 432120.05314000434 10 894.1124 2 4 27.3 11114 77 1 4765.10067114094 7 635.2883 2 9 26 28142 69 1 0 2 1022.0155 3 13 15.5 end label values eduisced edharm label def edharm 1 "1.less than upper secondary education", modify label def edharm 2 "2.upper secondary and vocational training", modify label def edharm 3 "3.tertiary education", modify label values country ncountry label def ncountry 1 "Japan", modify label def ncountry 2 "Austria", modify label def ncountry 3 "Germany", modify label def ncountry 4 "Sweden", modify label def ncountry 5 "Netherlands", modify label def ncountry 6 "Spain", modify label def ncountry 7 "Italy", modify label def ncountry 8 "France", modify label def ncountry 9 "Denmark", modify label def ncountry 10 "Greece", modify label def ncountry 11 "Switzerland", modify label def ncountry 12 "Belgium", modify label def ncountry 13 "Israel", modify label def ncountry 14 "Czech Republic", modify label def ncountry 15 "Poland", modify label def ncountry 16 "Ireland", modify
Thank you.
0 Response to How to estimate Hierarchical Linear Models in this case?
Post a Comment