------------------------------------------------------------------------------------- log: C:\AAA Miker Files\New stata files\Weight Tester\second clogg and eliaso > n weight tester.log log type: text opened on: 6 Nov 2002, 12:37:43 . use "C:\AAA Miker Files\New stata files\Weight Tester\clogg and eliason data.dta", > clear . table color labor, contents (sum uwcount sum wncount sum weight) by (sex) ------------------------------- sex and | labor color | 1 2 3 ----------+-------------------- 1 | 1 | 3511 4227 31467 | 3530 4183 31131 | 1431 1408 1408 | 2 | 604 356 2245 | 815 462 2783 | 1921 1849 1764 | 3 | 165 157 924 | 119 124 797 | 1029 1124 1228 ----------+-------------------- 2 | 1 | 2281 7833 18945 | 2234 7559 18704 | 1394 1373 1405 | 2 | 545 563 2132 | 653 644 2498 | 1705 1627 1668 | 3 | 89 216 725 | 64 162 574 | 1029 1070 1127 ------------------------------- . desmat: poisson uwcount sex*color sex*labor labor*color ------------------------------------------------------------------------------- poisson ------------------------------------------------------------------------------- Dependent variable uwcount Number of observations: 18 Initial log likelihood: -81627.074 Log likelihood: -123.390 LR chi square: 163007.367 Model degrees of freedom: 13 Pseudo R-squared: 0.998 Prob: 0.000 ------------------------------------------------------------------------------- nr Effect Coeff s.e. ------------------------------------------------------------------------------- uwcount sex 1 2 -0.446** 0.025 color 2 2 -1.771** 0.035 3 3 -3.178** 0.067 sex.color 4 2.2 0.354** 0.027 5 2.3 0.126** 0.044 labor 6 2 0.210** 0.022 7 3 2.182** 0.017 sex.labor 8 2.2 1.017** 0.030 9 2.3 -0.049 0.026 labor.color 10 2.2 -1.043** 0.048 11 2.3 -0.380** 0.084 12 3.2 -0.822** 0.036 13 3.3 -0.292** 0.069 14 _cons 8.170** 0.016 ------------------------------------------------------------------------------- * p < .05 ** p < .01 . poisgof Goodness-of-fit chi2 = 86.53056 Prob > chi2(4) = 0.0000 . poisgof, pearson Goodness-of-fit chi2 = 89.79915 Prob > chi2(4) = 0.0000 . *So the goodness of fit is the same, but the coefficients are different from what C > +E describe as Model 1, the unweighted data model. . *In order to get the same coefficients, we need to use the same system of dummy var > iable creation, which Desmat allows. . *Notice in C+E that they exclude the highest category from every variable reported. > So we'll construct deviation rather than indicator variables with the highest cat > egory excluded (see desmat help) . desmat sex*color color*labor labor*sex, dev(3) Desmat generated the following design matrix: nr Variables Term Parameterization First Last 1 _x_1 sex dev(2) 2 _x_2 _x_3 color dev(3) 3 _x_4 _x_5 sex.color dev(2).dev(3) 4 _x_6 _x_7 labor dev(3) 5 _x_8 _x_11 color.labor dev(3).dev(3) 6 _x_12 _x_13 labor.sex dev(3).dev(2) . poisson uwcount _x* Iteration 0: log likelihood = -58255.286 Iteration 1: log likelihood = -14700.743 Iteration 2: log likelihood = -7619.2808 Iteration 3: log likelihood = -404.6449 Iteration 4: log likelihood = -128.73746 Iteration 5: log likelihood = -123.39874 Iteration 6: log likelihood = -123.39028 Iteration 7: log likelihood = -123.39028 Poisson regression Number of obs = 18 LR chi2(13) = 163007.37 Prob > chi2 = 0.0000 Log likelihood = -123.39028 Pseudo R2 = 0.9985 ------------------------------------------------------------------------------ uwcount | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _x_1 | -.0181961 .0090799 -2.00 0.045 -.0359924 -.0003998 _x_2 | 1.851602 .0114051 162.35 0.000 1.829249 1.873956 _x_3 | -.3641969 .0141937 -25.66 0.000 -.392016 -.3363778 _x_4 | .0799572 .008727 9.16 0.000 .0628526 .0970618 _x_5 | -.0968465 .0111589 -8.68 0.000 -.1187175 -.0749755 _x_6 | -.6767398 .0175437 -38.57 0.000 -.7111248 -.6423548 _x_7 | -.4334031 .0165392 -26.20 0.000 -.4658193 -.4009869 _x_8 | -.2819597 .0183256 -15.39 0.000 -.3178773 -.2460422 _x_9 | .1926584 .0170488 11.30 0.000 .1592433 .2260735 _x_10 | .3398748 .0220346 15.42 0.000 .2966877 .3830619 _x_11 | -.2289205 .0218742 -10.47 0.000 -.2717932 -.1860478 _x_12 | .1613916 .0087324 18.48 0.000 .1442763 .1785069 _x_13 | -.3470565 .007409 -46.84 0.000 -.3615779 -.3325351 _cons | 7.053488 .0110162 640.28 0.000 7.031897 7.07508 ------------------------------------------------------------------------------ . desrep ------------------------------------------------------------------------------- poisson ------------------------------------------------------------------------------- Dependent variable uwcount Number of observations: 18 Initial log likelihood: -81627.074 Log likelihood: -123.390 LR chi square: 163007.367 Model degrees of freedom: 13 Pseudo R-squared: 0.998 Prob: 0.000 ------------------------------------------------------------------------------- nr Effect Coeff s.e. ------------------------------------------------------------------------------- uwcount sex 1 1 -0.018* 0.009 color 2 1 1.852** 0.011 3 2 -0.364** 0.014 sex.color 4 1.1 0.080** 0.009 5 1.2 -0.097** 0.011 labor 6 1 -0.677** 0.018 7 2 -0.433** 0.017 color.labor 8 1.1 -0.282** 0.018 9 1.2 0.193** 0.017 10 2.1 0.340** 0.022 11 2.2 -0.229** 0.022 labor.sex 12 1.1 0.161** 0.009 13 2.1 -0.347** 0.007 14 _cons 7.053** 0.011 ------------------------------------------------------------------------------- * p < .05 ** p < .01 . poisgof Goodness-of-fit chi2 = 86.53056 Prob > chi2(4) = 0.0000 . poisgof, pearson Goodness-of-fit chi2 = 89.79915 Prob > chi2(4) = 0.0000 . *Well, C+E report standardized values only for Model 1 . display -0.018/0.009 -2 . *That's the standardized coefficient. . summarize weight Punweight Variable | Obs Mean Std. Dev. Min Max -------------+----------------------------------------------------- weight | 18 1420 285.0249 1029 1921 Punweight | 18 4276.944 8132.604 106.8411 31318.39 . poisson wncount _x* Iteration 0: log likelihood = -58491.314 Iteration 1: log likelihood = -15823.834 Iteration 2: log likelihood = -8008.1313 Iteration 3: log likelihood = -337.28137 Iteration 4: log likelihood = -132.62736 Iteration 5: log likelihood = -130.05874 Iteration 6: log likelihood = -130.05724 Iteration 7: log likelihood = -130.05724 Poisson regression Number of obs = 18 LR chi2(13) = 159705.39 Prob > chi2 = 0.0000 Log likelihood = -130.05724 Pseudo R2 = 0.9984 ------------------------------------------------------------------------------ wncount | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _x_1 | .0129842 .0095783 1.36 0.175 -.0057889 .0317573 _x_2 | 1.858385 .0124712 149.01 0.000 1.833942 1.882828 _x_3 | -.1326472 .0145298 -9.13 0.000 -.161125 -.1041693 _x_4 | .0587654 .009245 6.36 0.000 .0406454 .0768854 _x_5 | -.0830024 .0111526 -7.44 0.000 -.1048611 -.0611436 _x_6 | -.6899361 .0195845 -35.23 0.000 -.7283211 -.6515511 _x_7 | -.4351573 .0179631 -24.23 0.000 -.4703643 -.3999502 _x_8 | -.2627302 .0202767 -12.96 0.000 -.3024719 -.2229885 _x_9 | .1860421 .0184547 10.08 0.000 .1498715 .2222128 _x_10 | .3837911 .0228968 16.76 0.000 .3389142 .428668 _x_11 | -.2316571 .0221664 -10.45 0.000 -.2751025 -.1882117 _x_12 | .1646876 .0086544 19.03 0.000 .1477253 .1816498 _x_13 | -.3404888 .0074003 -46.01 0.000 -.3549932 -.3259844 _cons | 7.032827 .0121105 580.72 0.000 7.009091 7.056563 ------------------------------------------------------------------------------ . desrep ------------------------------------------------------------------------------- poisson ------------------------------------------------------------------------------- Dependent variable wncount Number of observations: 18 Initial log likelihood: -79982.751 Log likelihood: -130.057 LR chi square: 159705.387 Model degrees of freedom: 13 Pseudo R-squared: 0.998 Prob: 0.000 ------------------------------------------------------------------------------- nr Effect Coeff s.e. ------------------------------------------------------------------------------- wncount sex 1 1 0.013 0.010 color 2 1 1.858** 0.012 3 2 -0.133** 0.015 sex.color 4 1.1 0.059** 0.009 5 1.2 -0.083** 0.011 labor 6 1 -0.690** 0.020 7 2 -0.435** 0.018 color.labor 8 1.1 -0.263** 0.020 9 1.2 0.186** 0.018 10 2.1 0.384** 0.023 11 2.2 -0.232** 0.022 labor.sex 12 1.1 0.165** 0.009 13 2.1 -0.340** 0.007 14 _cons 7.033** 0.012 ------------------------------------------------------------------------------- * p < .05 ** p < .01 . poisgof Goodness-of-fit chi2 = 100.2395 Prob > chi2(4) = 0.0000 . poisgof, pearson Goodness-of-fit chi2 = 104.0537 Prob > chi2(4) = 0.0000 . *Now you can see the unstandardized coefficients the same as C+E, and of course the > fit is the same. . . *Something absolutely wrong would be to take the weights as frequency counts. Thi > s would imply that we had 3511*1431 cases in the first cell! . *THIS IS THE MOST WRONG: (but people have done it) . poisson uwcount _x* [fweight= weight] Iteration 0: log likelihood = -83569633 Iteration 1: log likelihood = -21947476 Iteration 2: log likelihood = -11279495 Iteration 3: log likelihood = -511695.44 Iteration 4: log likelihood = -187246.98 Iteration 5: log likelihood = -181501.57 Iteration 6: log likelihood = -181493.96 Iteration 7: log likelihood = -181493.96 Poisson regression Number of obs = 25560 LR chi2(13) = 2.260e+08 Prob > chi2 = 0.0000 Log likelihood = -181493.96 Pseudo R2 = 0.9984 ------------------------------------------------------------------------------ uwcount | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _x_1 | -.0184664 .000254 -72.69 0.000 -.0189643 -.0179685 _x_2 | 1.849868 .0003302 5602.43 0.000 1.849221 1.850515 _x_3 | -.3615192 .0003847 -939.68 0.000 -.3622732 -.3607651 _x_4 | .0806387 .0002453 328.77 0.000 .080158 .0811195 _x_5 | -.0946885 .0002957 -320.27 0.000 -.0952679 -.094109 _x_6 | -.6783543 .000518 -1309.62 0.000 -.6793696 -.6773391 _x_7 | -.4287758 .0004758 -901.19 0.000 -.4297083 -.4278433 _x_8 | -.28043 .0005366 -522.64 0.000 -.2814817 -.2793784 _x_9 | .1882813 .0004889 385.15 0.000 .1873232 .1892394 _x_10 | .3370618 .0006059 556.26 0.000 .3358742 .3382495 _x_11 | -.2230669 .000587 -380.01 0.000 -.2242174 -.2219164 _x_12 | .1596509 .0002293 696.21 0.000 .1592015 .1601004 _x_13 | -.3443816 .0001961 -1755.98 0.000 -.344766 -.3439972 _cons | 7.055521 .0003205 . 0.000 7.054893 7.05615 ------------------------------------------------------------------------------ . poisgof Goodness-of-fit chi2 = 133227.9 Prob > chi2(25546) = 0.0000 . poisgof, pearson Goodness-of-fit chi2 = 137738.4 Prob > chi2(25546) = 0.0000 . *The residual df gets totally screwed up. . gen wrongcount= uwcount* weight . poisson wrongcount _x* Iteration 0: log likelihood = -83132521 Iteration 1: log likelihood = -22406394 Iteration 2: log likelihood = -11284544 Iteration 3: log likelihood = -367028.89 Iteration 4: log likelihood = -75469.497 Iteration 5: log likelihood = -71808.781 Iteration 6: log likelihood = -71806.645 Iteration 7: log likelihood = -71806.645 Poisson regression Number of obs = 18 LR chi2(13) = 2.273e+08 Prob > chi2 = 0.0000 Log likelihood = -71806.645 Pseudo R2 = 0.9994 ------------------------------------------------------------------------------ wrongcount | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _x_1 | .0129373 .0002538 50.97 0.000 .0124398 .0134348 _x_2 | 1.857719 .0003303 5625.06 0.000 1.857072 1.858366 _x_3 | -.1331285 .0003849 -345.91 0.000 -.1338828 -.1323742 _x_4 | .0588512 .000245 240.22 0.000 .058371 .0593314 _x_5 | -.0829262 .0002956 -280.58 0.000 -.0835055 -.0823469 _x_6 | -.6892702 .0005184 -1329.50 0.000 -.6902863 -.688254 _x_7 | -.435352 .0004758 -915.00 0.000 -.4362846 -.4344195 _x_8 | -.2632475 .0005368 -490.39 0.000 -.2642997 -.2621954 _x_9 | .1860421 .0004888 380.58 0.000 .185084 .1870002 _x_10 | .3831369 .0006063 631.89 0.000 .3819485 .3843253 _x_11 | -.2314243 .0005873 -394.07 0.000 -.2325753 -.2302732 _x_12 | .1646702 .0002294 717.86 0.000 .1642206 .1651198 _x_13 | -.3404477 .0001962 -1735.47 0.000 -.3408322 -.3400632 _cons | 14.29408 .0003207 . 0.000 14.29345 14.29471 ------------------------------------------------------------------------------ . poisgof Goodness-of-fit chi2 = 143357.3 Prob > chi2(4) = 0.0000 . poisgof, pearson Goodness-of-fit chi2 = 148750.5 Prob > chi2(4) = 0.0000 . desrep ------------------------------------------------------------------------------- poisson ------------------------------------------------------------------------------- Dependent variable wrongcount Number of observations: 18 Initial log likelihood: -113705261.063 Log likelihood: -71806.645 LR chi square: 227266908.838 Model degrees of freedom: 13 Pseudo R-squared: 0.999 Prob: 0.000 ------------------------------------------------------------------------------- nr Effect Coeff s.e. ------------------------------------------------------------------------------- wrongcount sex 1 1 0.013** 0.000 color 2 1 1.858** 0.000 3 2 -0.133** 0.000 sex.color 4 1.1 0.059** 0.000 5 1.2 -0.083** 0.000 labor 6 1 -0.689** 0.001 7 2 -0.435** 0.000 color.labor 8 1.1 -0.263** 0.001 9 1.2 0.186** 0.000 10 2.1 0.383** 0.001 11 2.2 -0.231** 0.001 labor.sex 12 1.1 0.165** 0.000 13 2.1 -0.340** 0.000 14 _cons 14.294** 0.000 ------------------------------------------------------------------------------- * p < .05 ** p < .01 . poisgof Goodness-of-fit chi2 = 143357.3 Prob > chi2(4) = 0.0000 . poisgof, pearson Goodness-of-fit chi2 = 148750.5 Prob > chi2(4) = 0.0000 . *THIS Model has the same coefficients as C+E model 2. It takes the weights into ac > count, but totally the wrong way. . *The goodness of fit is totally wrong (because the model thinks we have 1000 times > more cases than we actually have..) . poisson uwcount _x*, exposure(invweight) Iteration 0: log likelihood = -58435.474 Iteration 1: log likelihood = -14737.683 Iteration 2: log likelihood = -7445.2889 Iteration 3: log likelihood = -385.26436 Iteration 4: log likelihood = -129.30005 Iteration 5: log likelihood = -124.92425 Iteration 6: log likelihood = -124.91908 Iteration 7: log likelihood = -124.91908 Poisson regression Number of obs = 18 LR chi2(13) = 168988.22 Prob > chi2 = 0.0000 Log likelihood = -124.91908 Pseudo R2 = 0.9985 ------------------------------------------------------------------------------ uwcount | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _x_1 | .0125349 .0090761 1.38 0.167 -.005254 .0303238 _x_2 | 1.859666 .0114064 163.04 0.000 1.83731 1.882022 _x_3 | -.1361775 .0142002 -9.59 0.000 -.1640094 -.1083456 _x_4 | .05847 .0087202 6.71 0.000 .0413788 .0755612 _x_5 | -.0849442 .0111604 -7.61 0.000 -.1068183 -.0630701 _x_6 | -.6875702 .0175602 -39.15 0.000 -.7219876 -.6531528 _x_7 | -.440195 .0165402 -26.61 0.000 -.4726131 -.4077769 _x_8 | -.2646678 .0183343 -14.44 0.000 -.3006025 -.2287332 _x_9 | .1905144 .017049 11.17 0.000 .157099 .2239298 _x_10 | .3857783 .0220507 17.50 0.000 .3425597 .428997 _x_11 | -.2377099 .0218874 -10.86 0.000 -.2806085 -.1948114 _x_12 | .1658594 .0087354 18.99 0.000 .1487383 .1829805 _x_13 | -.3431413 .007411 -46.30 0.000 -.3576666 -.3286161 _cons | 14.29186 .0110205 1296.84 0.000 14.27026 14.31346 invweight | (exposure) ------------------------------------------------------------------------------ . desrep ------------------------------------------------------------------------------- poisson ------------------------------------------------------------------------------- Dependent variable uwcount Offset variable: ln(invweight) Number of observations: 18 Initial log likelihood: -84619.027 Log likelihood: -124.919 LR chi square: 168988.216 Model degrees of freedom: 13 Pseudo R-squared: 0.999 Prob: 0.000 ------------------------------------------------------------------------------- nr Effect Coeff s.e. ------------------------------------------------------------------------------- uwcount sex 1 1 0.013 0.009 color 2 1 1.860** 0.011 3 2 -0.136** 0.014 sex.color 4 1.1 0.058** 0.009 5 1.2 -0.085** 0.011 labor 6 1 -0.688** 0.018 7 2 -0.440** 0.017 color.labor 8 1.1 -0.265** 0.018 9 1.2 0.191** 0.017 10 2.1 0.386** 0.022 11 2.2 -0.238** 0.022 labor.sex 12 1.1 0.166** 0.009 13 2.1 -0.343** 0.007 14 _cons 14.292** 0.011 ------------------------------------------------------------------------------- * p < .05 ** p < .01 . poisgof Goodness-of-fit chi2 = 89.58815 Prob > chi2(4) = 0.0000 . poisgof, pearson Goodness-of-fit chi2 = 93.54537 Prob > chi2(4) = 0.0000 . *Here again, the coefficients are the same. But the goodness of fit statistic is c > orrect in this case. . *This approach uses the weights to properly shape the coefficients, but relies on u > nweighted counts to generate the standard errors of the coefficients. . save "C:\AAA Miker Files\New stata files\Weight Tester\clogg and eliason data.dta", > replace file C:\AAA Miker Files\New stata files\Weight Tester\clogg and eliason data.dta save > d . exit, clear ---------------------------------------------------------------------------------------- log: C:\AAA Miker Files\New stata files\Weight Tester\second clogg and eliason w > eight tester.log log type: text opened on: 6 Nov 2002, 13:29:36 . use "C:\AAA Miker Files\New stata files\Weight Tester\clogg and eliason data.dta", cle > ar . *The previous material in this log file was done by me before class . table color labor, by(sex) contents (sum uwcount wncount weight) wncount invalid r(198); . table color labor, by(sex) contents (sum uwcount sum wncount sum weight) ------------------------------- sex and | labor color | 1 2 3 ----------+-------------------- 1 | 1 | 3511 4227 31467 | 3530 4183 31131 | 1431 1408 1408 | 2 | 604 356 2245 | 815 462 2783 | 1921 1849 1764 | 3 | 165 157 924 | 119 124 797 | 1029 1124 1228 ----------+-------------------- 2 | 1 | 2281 7833 18945 | 2234 7559 18704 | 1394 1373 1405 | 2 | 545 563 2132 | 653 644 2498 | 1705 1627 1668 | 3 | 89 216 725 | 64 162 574 | 1029 1070 1127 ------------------------------- . describe Contains data from C:\AAA Miker Files\New stata files\Weight Tester\clogg and eliason > data.dta obs: 18 vars: 36 6 Nov 2002 13:05 size: 990 (99.7% of memory free) ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- sex byte %8.0g color byte %8.0g labor byte %8.0g uwcount int %8.0g wncount int %8.0g weight int %8.0g invweight float %9.0g Punweight float %9.0g predicted number of events _Ilabor_1 byte %8.0g labor==1 _Ilabor_2 byte %8.0g labor==2 _Isex_1 byte %8.0g sex==1 _IlabXsex_1_1 byte %8.0g labor==1 & sex==1 _IlabXsex_2_1 byte %8.0g labor==2 & sex==1 _Icolor_1 byte %8.0g color==1 _Icolor_2 byte %8.0g color==2 _IlabXcol_1_1 byte %8.0g labor==1 & color==1 _IlabXcol_1_2 byte %8.0g labor==1 & color==2 _IlabXcol_2_1 byte %8.0g labor==2 & color==1 _IlabXcol_2_2 byte %8.0g labor==2 & color==2 _IsexXcol_1_1 byte %8.0g sex==1 & color==1 _IsexXcol_1_2 byte %8.0g sex==1 & color==2 Pcorrect_inv_~e float %9.0g predicted number of events _x_1 byte %8.0g sex==1 _x_2 byte %8.0g color==1 _x_3 byte %8.0g color==2 _x_4 byte %9.0g sex==1.color==1 _x_5 byte %9.0g sex==1.color==2 _x_6 byte %8.0g labor==1 _x_7 byte %8.0g labor==2 _x_8 byte %9.0g color==1.labor==1 _x_9 byte %9.0g color==1.labor==2 _x_10 byte %9.0g color==2.labor==1 _x_11 byte %9.0g color==2.labor==2 _x_12 byte %9.0g labor==1.sex==1 _x_13 byte %9.0g labor==2.sex==1 wrongcount float %9.0g ------------------------------------------------------------------------------- Sorted by: . label def sex 1 "male" 2 "female" . label def color 1 "white" 2 "black" 3 "other" . label def labor 1 "unemployed" 2 "part-time" 3 "other . label val sex sex . label val color color . label val labor labor . save "C:\AAA Miker Files\New stata files\Weight Tester\clogg and eliason data.dta", > replace file C:\AAA Miker Files\New stata files\Weight Tester\clogg and eliason data.dta save > d . table color labor, by(sex) contents (sum uwcount sum wncount sum weight) ---------------------------------------------- sex and | labor color | unemployed part-time other ----------+----------------------------------- male | white | 3511 4227 31467 | 3530 4183 31131 | 1431 1408 1408 | black | 604 356 2245 | 815 462 2783 | 1921 1849 1764 | other | 165 157 924 | 119 124 797 | 1029 1124 1228 ----------+----------------------------------- female | white | 2281 7833 18945 | 2234 7559 18704 | 1394 1373 1405 | black | 545 563 2132 | 653 644 2498 | 1705 1627 1668 | other | 89 216 725 | 64 162 574 | 1029 1070 1127 ---------------------------------------------- . *notice that the weights (the third number) varies by group . table color, contents (mean weight) ------------------------ color | mean(weight) ----------+------------- white | 1403.17 black | 1755.67 other | 1101.17 ------------------------ . *Blacks have the highest weight because they are presumably the most underrepresent > ed people in the survey. . *If we wanted a full accounting of the US population by sex, race, and labor force > participation, we'd have to multiply the unweighted counts by the weights. . . table color labor [fweight=weight], by(sex) contents (sum uwcount sum wncount sum > weight) ---------------------------------------------- sex and | labor color | unemployed part-time other ----------+----------------------------------- male | white | 5024241 5951616 4.43e+07 | 5051430 5889664 4.38e+07 | 2047761 1982464 1982464 | black | 1160284 658244 3960180 | 1565615 854238 4909212 | 3690241 3418801 3111696 | other | 169785 176468 1134672 | 122451 139376 978716 | 1058841 1263376 1507984 ----------+----------------------------------- female | white | 3179714 1.08e+07 2.66e+07 | 3114196 1.04e+07 2.63e+07 | 1943236 1885129 1974025 | black | 929225 916001 3556176 | 1113365 1047788 4166664 | 2907025 2647129 2782224 | other | 91581 231120 817075 | 65856 173340 646898 | 1058841 1144900 1270129 ---------------------------------------------- . *This is, according to the survey and the statisticians who created the weights, th > e actual US population by sex color and labor. . table color labor [fweight=weight], by(sex) contents (sum uwcount sum wncount sum > weight) row col ---------------------------------------------------------- sex and | labor color | unemployed part-time other Total ----------+----------------------------------------------- male | white | 5024241 5951616 4.43e+07 5.53e+07 | 5051430 5889664 4.38e+07 5.48e+07 | 2047761 1982464 1982464 6012689 | black | 1160284 658244 3960180 5778708 | 1565615 854238 4909212 7329065 | 3690241 3418801 3111696 1.02e+07 | other | 169785 176468 1134672 1480925 | 122451 139376 978716 1240543 | 1058841 1263376 1507984 3830201 | Total | 6354310 6786328 4.94e+07 6.25e+07 | 6739496 6883278 4.97e+07 6.33e+07 | 6796843 6664641 6602144 2.01e+07 ----------+----------------------------------------------- female | white | 3179714 1.08e+07 2.66e+07 4.06e+07 | 3114196 1.04e+07 2.63e+07 3.98e+07 | 1943236 1885129 1974025 5802390 | black | 929225 916001 3556176 5401402 | 1113365 1047788 4166664 6327817 | 2907025 2647129 2782224 8336378 | other | 91581 231120 817075 1139776 | 65856 173340 646898 886094 | 1058841 1144900 1270129 3473870 | Total | 4200520 1.19e+07 3.10e+07 4.71e+07 | 4293417 1.16e+07 3.11e+07 4.70e+07 | 5909102 5677158 6026378 1.76e+07 ---------------------------------------------------------- . table color labor, by(sex) contents (sum uwcount sum wncount sum weight) row col ---------------------------------------------------------- sex and | labor color | unemployed part-time other Total ----------+----------------------------------------------- male | white | 3511 4227 31467 39205 | 3530 4183 31131 38844 | 1431 1408 1408 4247 | black | 604 356 2245 3205 | 815 462 2783 4060 | 1921 1849 1764 5534 | other | 165 157 924 1246 | 119 124 797 1040 | 1029 1124 1228 3381 | Total | 4280 4740 34636 43656 | 4464 4769 34711 43944 | 4381 4381 4400 13162 ----------+----------------------------------------------- female | white | 2281 7833 18945 29059 | 2234 7559 18704 28497 | 1394 1373 1405 4172 | black | 545 563 2132 3240 | 653 644 2498 3795 | 1705 1627 1668 5000 | other | 89 216 725 1030 | 64 162 574 800 | 1029 1070 1127 3226 | Total | 2915 8612 21802 33329 | 2951 8365 21776 33092 | 4128 4070 4200 12398 ---------------------------------------------------------- . poisson uwcount _x*, exposure ( invweight) Iteration 0: log likelihood = -58435.474 Iteration 1: log likelihood = -14737.683 Iteration 2: log likelihood = -7445.2889 Iteration 3: log likelihood = -385.26436 Iteration 4: log likelihood = -129.30005 Iteration 5: log likelihood = -124.92425 Iteration 6: log likelihood = -124.91908 Iteration 7: log likelihood = -124.91908 Poisson regression Number of obs = 18 LR chi2(13) = 168988.22 Prob > chi2 = 0.0000 Log likelihood = -124.91908 Pseudo R2 = 0.9985 ------------------------------------------------------------------------------ uwcount | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _x_1 | .0125349 .0090761 1.38 0.167 -.005254 .0303238 _x_2 | 1.859666 .0114064 163.04 0.000 1.83731 1.882022 _x_3 | -.1361775 .0142002 -9.59 0.000 -.1640094 -.1083456 _x_4 | .05847 .0087202 6.71 0.000 .0413788 .0755612 _x_5 | -.0849442 .0111604 -7.61 0.000 -.1068183 -.0630701 _x_6 | -.6875702 .0175602 -39.15 0.000 -.7219876 -.6531528 _x_7 | -.440195 .0165402 -26.61 0.000 -.4726131 -.4077769 _x_8 | -.2646678 .0183343 -14.44 0.000 -.3006025 -.2287332 _x_9 | .1905144 .017049 11.17 0.000 .157099 .2239298 _x_10 | .3857783 .0220507 17.50 0.000 .3425597 .428997 _x_11 | -.2377099 .0218874 -10.86 0.000 -.2806085 -.1948114 _x_12 | .1658594 .0087354 18.99 0.000 .1487383 .1829805 _x_13 | -.3431413 .007411 -46.30 0.000 -.3576666 -.3286161 _cons | 14.29186 .0110205 1296.84 0.000 14.27026 14.31346 invweight | (exposure) ------------------------------------------------------------------------------ . desrep ------------------------------------------------------------------------------- poisson ------------------------------------------------------------------------------- Dependent variable uwcount Offset variable: ln(invweight) Number of observations: 18 Initial log likelihood: -84619.027 Log likelihood: -124.919 LR chi square: 168988.216 Model degrees of freedom: 13 Pseudo R-squared: 0.999 Prob: 0.000 ------------------------------------------------------------------------------- nr Effect Coeff s.e. ------------------------------------------------------------------------------- uwcount sex 1 1 0.013 0.009 color 2 1 1.860** 0.011 3 2 -0.136** 0.014 sex.color 4 1.1 0.058** 0.009 5 1.2 -0.085** 0.011 labor 6 1 -0.688** 0.018 7 2 -0.440** 0.017 color.labor 8 1.1 -0.265** 0.018 9 1.2 0.191** 0.017 10 2.1 0.386** 0.022 11 2.2 -0.238** 0.022 labor.sex 12 1.1 0.166** 0.009 13 2.1 -0.343** 0.007 14 _cons 14.292** 0.011 ------------------------------------------------------------------------------- * p < .05 ** p < .01 . poisgof Goodness-of-fit chi2 = 89.58815 Prob > chi2(4) = 0.0000 . poisgof, pearson Goodness-of-fit chi2 = 93.54537 Prob > chi2(4) = 0.0000 . * . *This is model 3 . *SO, the coefficients from the RIGHT model, which corresponds to C+E #3 are the sam > e coefficients as all the other models that incorporate weights (some of which are > very bad). And the standard errors of these coefficients are exactly the same as t > he SE we got from the first run, with the unweighted data. . save "C:\AAA Miker Files\New stata files\Weight Tester\clogg and eliason data.dta", > replace file C:\AAA Miker Files\New stata files\Weight Tester\clogg and eliason data.dta save > d . exit, clear