These are the job-satisfaction data from Agresti, page 262, Table 8.1. . ta income jobsat [freq=count] | Job Satisfaction Income ($) | V Diss Ltl Diss Mod Sat V Sat | Total -----------+--------------------------------------------+---------- <6K | 20 24 80 82 | 206 6-15K | 22 38 104 125 | 289 15-25K | 13 28 81 113 | 235 >25K | 7 18 54 92 | 171 -----------+--------------------------------------------+---------- Total | 62 108 319 412 | 901 . loglin count income jobsat, fit(income, jobsat) keep resid Variable income = A Variable jobsat = B Margins fit: income, jobsat Note: Regression-like constraints are assumed. The first level of each variable (and all iteractions with it) will be dropped from estimation. Iteration 0: Log Likelihood = -50.77832 Iteration 1: Log Likelihood = -50.533936 Iteration 2: Log Likelihood = -50.533691 Poisson regression Number of obs = 16 Goodness-of-fit chi2(9) = 12.037 Model chi2(6) = 433.726 Prob > chi2 = 0.2113 Prob > chi2 = 0.0000 Log Likelihood = -50.534 Pseudo R2 = 0.8110 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- A2 | .3385507 .0911843 3.713 0.000 .1598327 .5172686 A3 | .1317093 .0954447 1.380 0.168 -.0553589 .3187774 A4 | -.1862126 .103452 -1.800 0.072 -.3889749 .0165496 B2 | .5549968 .159337 3.483 0.000 .2427019 .8672917 B3 | 1.638057 .1387942 11.802 0.000 1.366025 1.910088 B4 | 1.893889 .1362212 13.903 0.000 1.6269 2.160878 _cons | 2.651505 .1409735 18.809 0.000 2.375202 2.927808 ------------------------------------------------------------------------------ count income jobsat cellhat resid stdres 20 <6K V Diss 14.175 5.825 1.547 24 <6K Ltl Diss 24.693 -0.693 -0.139 80 <6K Mod Sat 72.935 7.065 0.827 82 <6K V Sat 94.198 -12.198 -1.257 22 6-15K V Diss 19.887 2.113 0.474 38 6-15K Ltl Diss 34.642 3.358 0.571 104 6-15K Mod Sat 102.321 1.679 0.166 125 6-15K V Sat 132.151 -7.151 -0.622 13 15-25K V Diss 16.171 -3.171 -0.789 28 15-25K Ltl Diss 28.169 -0.169 -0.032 81 15-25K Mod Sat 83.202 -2.202 -0.241 113 15-25K V Sat 107.458 5.542 0.535 7 >25K V Diss 11.767 -4.767 -1.390 18 >25K Ltl Diss 20.497 -2.497 -0.552 54 >25K Mod Sat 60.543 -6.543 -0.841 92 >25K V Sat 78.193 13.807 1.561 . tabdisp income jobsat, c(count cellhat) f(%5.1f) ----------+--------------------------------------- Income | Job Satisfaction ($) | V Diss Ltl Diss Mod Sat V Sat ----------+--------------------------------------- <6K | 20.0 24.0 80.0 82.0 | 14.2 24.7 72.9 94.2 | 6-15K | 22.0 38.0 104.0 125.0 | 19.9 34.6 102.3 132.2 | 15-25K | 13.0 28.0 81.0 113.0 | 16.2 28.2 83.2 107.5 | >25K | 7.0 18.0 54.0 92.0 | 11.8 20.5 60.5 78.2 ----------+--------------------------------------- . tabdisp income jobsat, c(stdres) f(%5.2f) ----------+--------------------------------------- Income | Job Satisfaction ($) | V Diss Ltl Diss Mod Sat V Sat ----------+--------------------------------------- <6K | 1.55 -0.14 0.83 -1.26 6-15K | 0.47 0.57 0.17 -0.62 15-25K | -0.79 -0.03 -0.24 0.53 >25K | -1.39 -0.55 -0.84 1.56 ----------+--------------------------------------- . gen u = (income - 2.5) . gen v = (jobsat - 2.5) . gen uv = u*v . poisson count A2-A4 B2-B4 uv Iteration 0: Log Likelihood = -45.794434 Iteration 1: Log Likelihood = -45.708252 Poisson regression Number of obs = 16 Goodness-of-fit chi2(8) = 2.386 Model chi2(7) = 443.376 Prob > chi2 = 0.9668 Prob > chi2 = 0.0000 Log Likelihood = -45.708 Pseudo R2 = 0.8291 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- A2 | .2693184 .0933483 2.885 0.004 .086359 .4522778 A3 | -.0172245 .1062481 -0.162 0.871 -.225467 .191018 A4 | -.4243433 .1303013 -3.257 0.001 -.6797291 -.1689576 B2 | .5873737 .1603513 3.663 0.000 .2730909 .9016566 B3 | 1.689759 .1415896 11.934 0.000 1.412248 1.967269 B4 | 1.95152 .1394677 13.993 0.000 1.678168 2.224871 uv | .1119394 .0364076 3.075 0.002 .0405818 .1832969 _cons | 2.710686 .1385931 19.559 0.000 2.439048 2.982323 ------------------------------------------------------------------------------ . display exp(.1119394) 1.1184451 . predict linpred . gen mhat = exp(linpred) . gen ures = count-mhat . gen pres = ures/sqrt(mhat) . tabdisp income jobsat, c(count mhat) f(%5.1f) ----------+--------------------------------------- Income | Job Satisfaction ($) | V Diss Ltl Diss Mod Sat V Sat ----------+--------------------------------------- <6K | 20.0 24.0 80.0 82.0 | 19.3 29.4 74.9 82.3 | 6-15K | 22.0 38.0 104.0 125.0 | 21.4 36.4 103.7 127.4 | 15-25K | 13.0 28.0 81.0 113.0 | 13.6 25.9 82.4 113.2 | >25K | 7.0 18.0 54.0 92.0 | 7.6 16.3 58.0 89.1 ----------+--------------------------------------- . tabdisp income jobsat, c(pres) f(%5.2f) ----------+--------------------------------------- Income | Job Satisfaction ($) | V Diss Ltl Diss Mod Sat V Sat ----------+--------------------------------------- <6K | 0.15 -1.00 0.59 -0.03 6-15K | 0.13 0.26 0.03 -0.22 15-25K | -0.16 0.42 -0.15 -0.02 >25K | -0.23 0.43 -0.52 0.31 ----------+--------------------------------------- . gen M2 = v*A2 . gen M3 = v*A3 . gen M4 = v*A4 . poisson count A2-A4 B2-B4 M2-M4 Iteration 0: Log Likelihood = -45.672363 Iteration 1: Log Likelihood = -45.583984 Poisson regression Number of obs = 16 Goodness-of-fit chi2(6) = 2.137 Model chi2(9) = 443.625 Prob > chi2 = 0.9067 Prob > chi2 = 0.0000 Log Likelihood = -45.584 Pseudo R2 = 0.8295 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- A2 | .2951395 .1090539 2.706 0.007 .0813978 .5088813 A3 | -.0006419 .1189394 -0.005 0.996 -.2337589 .2324751 A4 | -.4306371 .1377801 -3.126 0.002 -.7006811 -.1605931 B2 | .4401635 .169307 2.600 0.009 .1083278 .7719992 B3 | 1.395387 .183075 7.622 0.000 1.036567 1.754208 B4 | 1.509407 .2311292 6.531 0.000 1.056402 1.962412 M2 | .0702025 .0973398 0.721 0.471 -.1205801 .2609851 M3 | .1971037 .1050539 1.876 0.061 -.0087981 .4030055 M4 | .3368345 .1196027 2.816 0.005 .1024175 .5712515 _cons | 2.919711 .18818 15.516 0.000 2.550885 3.288537 ------------------------------------------------------------------------------ . gen N2 = u*B2 . gen N3 = u*B3 . gen N4 = u*B4 . poisson count A2-A4 B2-B4 N2-N4 Iteration 0: Log Likelihood = -44.849365 Iteration 1: Log Likelihood = -44.778076 Poisson regression Number of obs = 16 Goodness-of-fit chi2(6) = 0.525 Model chi2(9) = 445.237 Prob > chi2 = 0.9975 Prob > chi2 = 0.0000 Log Likelihood = -44.778 Pseudo R2 = 0.8325 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- A2 | .0617688 .1502348 0.411 0.681 -.232686 .3562237 A3 | -.4343672 .2623646 -1.656 0.098 -.9485923 .079858 A4 | -1.052906 .3873899 -2.718 0.007 -1.812176 -.2936356 B2 | .6200406 .1673324 3.705 0.000 .2920751 .9480061 B3 | 1.699219 .1476597 11.508 0.000 1.409811 1.988627 B4 | 1.966543 .1449974 13.563 0.000 1.682353 2.250732 N2 | .2500316 .1586539 1.576 0.115 -.0609245 .5609876 N3 | .2230742 .1394019 1.600 0.110 -.0501484 .4962969 N4 | .3907879 .1371861 2.849 0.004 .1219081 .6596678 _cons | 3.008617 .193512 15.547 0.000 2.629341 3.387894 ------------------------------------------------------------------------------