Section 9.1.1 McNemar Test.
The code below for creating the data set can be copied to the Stata Do-file Editor and be executed through the Do-file Editor.
clear input r1 r2 count 0 0 794 0 1 150 1 0 86 1 1 570 end symmetry r1 r2 [fw=count] ------------------------------- | r2 r1 | 0 1 Total ----------+-------------------- 0 | 794 150 944 1 | 86 570 656 | Total | 880 720 1600 ------------------------------- chi2 df Prob>chi2 ------------------------------------------------------------------------ Symmetry (asymptotic) | 17.36 1 0.0000 Marginal homogeneity (Stuart-Maxwell) | 17.36 1 0.0000 ------------------------------------------------------------------------ di sqrt(r(chi2)) 4.1660452
Section 9.1.2 Estimating Differences of Proportions
mcc r2 r1 [fw=count] | Controls | Cases | Exposed Unexposed | Total -----------------+------------------------+---------- Exposed | 570 150 | 720 Unexposed | 86 794 | 880 -----------------+------------------------+---------- Total | 656 944 | 1600 McNemar's chi2(1) = 17.36 Prob > chi2 = 0.0000 Exact McNemar significance probability = 0.0000 Proportion with factor Cases .45 Controls .41 [95% Conf. Interval] --------- -------------------- difference .04 .0206589 .0593411 ratio 1.097561 1.050514 1.146715 rel. diff. .0677966 .0370011 .0985921 odds ratio 1.744186 1.329228 2.300979 (exact)
Section 9.2.2 A Logit Model for Matched-Pairs Data on page 231.
expand count drop count gen id = _n reshape long r, i(id) j(m) recode m 2=0 recode r 0 = 1 1=0 clogit r m, or group(id) note: multiple positive outcomes within groups encountered. note: 1364 groups (2728 obs) dropped due to all positive or all negative outcomes. Conditional (fixed-effects) logistic regression Number of obs = 472 LR chi2(1) = 17.58 Prob > chi2 = 0.0000 Log likelihood = -154.79514 Pseudo R2 = 0.0537 ------------------------------------------------------------------------------ r | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- m | 1.744186 .2359133 4.11 0.000 1.338018 2.273651 ------------------------------------------------------------------------------
Section 9.2.3 Logistic Regression for Matched Case-Control Studies
The following code for creating a data set can be copied to Stata Do-file Editor and be executed within the Do-file Editor.
* TABLE 9.3 clear input c1 c2 count 1 1 9 1 0 16 0 1 37 0 0 119 end expand count gen id = _n reshape long c, i(id) j(m) clogit c m, group(id) note: multiple positive outcomes within groups encountered. note: 128 groups (256 obs) dropped due to all positive or all negative outcomes. Conditional (fixed-effects) logistic regression Number of obs = 106 LR chi2(1) = 8.55 Prob > chi2 = 0.0034 Log likelihood = -32.460089 Pseudo R2 = 0.1164 ------------------------------------------------------------------------------ c | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- m | .8383292 .2992107 2.80 0.005 .251887 1.424771 ------------------------------------------------------------------------------ clogit c m, group(id) or note: multiple positive outcomes within groups encountered. note: 128 groups (256 obs) dropped due to all positive or all negative outcomes. Conditional (fixed-effects) logistic regression Number of obs = 106 LR chi2(1) = 8.55 Prob > chi2 = 0.0034 Log likelihood = -32.460089 Pseudo R2 = 0.1164 ------------------------------------------------------------------------------ c | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- m | 2.3125 .6919247 2.80 0.005 1.286451 4.156907 ------------------------------------------------------------------------------
Section 9.3.2 Coffee Market Share Example. Test on symmetry models. The list command displays all the observations and we can see how the variable for symmetry is constructed. The other variable qs will be used later for quasi-independence models. We ran both the glm model and Stata’s symmetry command to show two ways in Stata to test on a symmetry model.
use https://stats.idre.ucla.edu/stat/stata/examples/icda/coffee, clear list +---------------------------------------------+ | p1 p2 count qs symm | |---------------------------------------------| 1. | High Point High Point 93 1 1 | 2. | High Point Taster's 17 6 2 | 3. | High Point Sanka 44 6 3 | 4. | High Point Nescafe 7 6 4 | 5. | High Point Brim 10 6 5 | |---------------------------------------------| 6. | Taster's High Point 9 6 2 | 7. | Taster's Taster's 46 2 6 | 8. | Taster's Sanka 11 6 7 | 9. | Taster's Nescafe 0 6 8 | 10. | Taster's Brim 9 6 9 | |---------------------------------------------| 11. | Sanka High Point 17 6 3 | 12. | Sanka Taster's 11 6 7 | 13. | Sanka Sanka 155 3 10 | 14. | Sanka Nescafe 9 6 11 | 15. | Sanka Brim 12 6 12 | |---------------------------------------------| 16. | Nescafe High Point 6 6 4 | 17. | Nescafe Taster's 4 6 8 | 18. | Nescafe Sanka 9 6 11 | 19. | Nescafe Nescafe 15 4 13 | 20. | Nescafe Brim 2 6 14 | |---------------------------------------------| 21. | Brim High Point 10 6 5 | 22. | Brim Taster's 4 6 9 | 23. | Brim Sanka 12 6 12 | 24. | Brim Nescafe 2 6 14 | 25. | Brim Brim 27 5 15 | +---------------------------------------------+ xi: glm count i.symm, fam(poi) nolog i.symm _Isymm_1-15 (naturally coded; _Isymm_1 omitted) Generalized linear models No. of obs = 25 Optimization : ML: Newton-Raphson Residual df = 10 Scale parameter = 1 Deviance = 22.47293283 (1/df) Deviance = 2.247293 Pearson = 20.41235813 (1/df) Pearson = 2.041236 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -63.50502298 AIC = 6.280402 BIC = -9.715825421 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Isymm_2 | -1.96765 .2218428 -8.87 0.000 -2.402454 -1.532846 _Isymm_3 | -1.114873 .1647608 -6.77 0.000 -1.437798 -.7919475 _Isymm_4 | -2.660797 .2961009 -8.99 0.000 -3.241144 -2.08045 _Isymm_5 | -2.230014 .2464806 -9.05 0.000 -2.713108 -1.746921 _Isymm_6 | -.7039581 .1802549 -3.91 0.000 -1.057251 -.350665 _Isymm_7 | -2.134704 .2370806 -9.00 0.000 -2.599374 -1.670035 _Isymm_8 | -3.839452 .5106395 -7.52 0.000 -4.840287 -2.838617 _Isymm_9 | -2.660797 .2961009 -8.99 0.000 -3.241144 -2.08045 _Isymm_10 | .5108256 .1311652 3.89 0.000 .2537466 .7679046 _Isymm_11 | -2.335375 .2575039 -9.07 0.000 -2.840073 -1.830677 _Isymm_12 | -2.047693 .2289527 -8.94 0.000 -2.496432 -1.598954 _Isymm_13 | -1.824549 .2782433 -6.56 0.000 -2.369896 -1.279202 _Isymm_14 | -3.839452 .5106395 -7.52 0.000 -4.840287 -2.838617 _Isymm_15 | -1.236763 .2186086 -5.66 0.000 -1.665228 -.8082976 _cons | 4.532599 .1036952 43.71 0.000 4.329361 4.735838 ------------------------------------------------------------------------------ symmetry p1 p2 [fw=count], notable chi2 df Prob>chi2 ------------------------------------------------------------------------ Symmetry (asymptotic) | 20.41 10 0.0256 Marginal homogeneity (Stuart-Maxwell) | 12.29 4 0.0153 ------------------------------------------------------------------------
Section 9.3.3 Quasi Symmetry on page 236.
xi: glm count i.p1 i.p2 i.symm, fam(poi) nolog i.p1 _Ip1_1-5 (naturally coded; _Ip1_1 omitted) i.p2 _Ip2_1-5 (naturally coded; _Ip2_1 omitted) i.symm _Isymm_1-15 (naturally coded; _Isymm_1 omitted) note: _Isymm_6 dropped due to collinearity note: _Isymm_10 dropped due to collinearity note: _Isymm_13 dropped due to collinearity note: _Isymm_15 dropped due to collinearity Generalized linear models No. of obs = 25 Optimization : ML: Newton-Raphson Residual df = 6 Scale parameter = 1 Deviance = 9.974046925 (1/df) Deviance = 1.662341 Pearson = 8.530328477 (1/df) Pearson = 1.421721 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -57.25558002 AIC = 6.100446 BIC = -9.339208024 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Ip1_2 | -.6517011 .1674134 -3.89 0.000 -.9798254 -.3235769 _Ip1_3 | -.0989566 .127788 -0.77 0.439 -.3494166 .1515033 _Ip1_4 | -1.058937 .2238647 -4.73 0.000 -1.497704 -.62017 _Ip1_5 | -.9161012 .183047 -5.00 0.000 -1.274867 -.5573356 _Ip2_2 | -.052257 .1674134 -0.31 0.755 -.3803812 .2758673 _Ip2_3 | .6097823 .127788 4.77 0.000 .3593223 .8602422 _Ip2_4 | -.7656124 .2238647 -3.42 0.001 -1.204379 -.3268456 _Ip2_5 | -.3206615 .183047 -1.75 0.080 -.6794271 .0381041 _Isymm_2 | -1.659931 .2197059 -7.56 0.000 -2.090547 -1.229315 _Isymm_3 | -1.431803 .1486171 -9.63 0.000 -1.723087 -1.140519 _Isymm_4 | -1.759239 .3113361 -5.65 0.000 -2.369447 -1.149032 _Isymm_5 | -1.655312 .2524893 -6.56 0.000 -2.150182 -1.160442 _Isymm_7 | -2.03963 .2292631 -8.90 0.000 -2.488978 -1.590283 _Isymm_8 | -2.586867 .5225077 -4.95 0.000 -3.610963 -1.562771 _Isymm_9 | -1.690439 .3026834 -5.58 0.000 -2.283687 -1.09719 _Isymm_11 | -1.699931 .2739694 -6.20 0.000 -2.236901 -1.162961 _Isymm_12 | -1.686328 .2293554 -7.35 0.000 -2.135856 -1.2368 _Isymm_14 | -2.320162 .5261484 -4.41 0.000 -3.351394 -1.288931 _cons | 4.532599 .1036952 43.71 0.000 4.329361 4.735838 ------------------------------------------------------------------------------ predict p (option mu assumed; predicted mean count) table p1 p2, contents(sum count sum p) ----------------------------------------------------------------------- | p2 p1 | High Point Taster's Sanka Nescafe Brim -----------+----------------------------------------------------------- High Point | 93 17 44 7 10 | 93 16.78376 40.87747 7.446527 12.89225 | Taster's | 9 46 11 0 9 | 9.216243 46 11.60052 1.696249 6.486985 | Sanka | 17 11 155 9 12 | 20.12253 10.39948 155 7.157062 11.32093 | Nescafe | 6 4 9 15 2 | 5.553473 2.303751 10.84294 15 2.299838 | Brim | 10 4 12 2 27 | 7.107754 6.513015 12.67907 1.700162 27 -----------------------------------------------------------------------
Section 9.3.5 Premarital and Extramarital Sex Example on page 238.
use https://stats.idre.ucla.edu/stat/stata/examples/icda/marital, clear xi: glm count i.symm, fam(poi) nolog /*symmetry*/ i.symm _Isymm_1-10 (naturally coded; _Isymm_1 omitted) Generalized linear models No. of obs = 16 Optimization : ML: Newton-Raphson Residual df = 6 Scale parameter = 1 Deviance = 402.2028677 (1/df) Deviance = 67.03381 Pearson = 297.610989 (1/df) Pearson = 49.60183 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -229.8458217 AIC = 29.98073 BIC = 385.5673354 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Isymm_2 | -2.107612 .1884566 -11.18 0.000 -2.47698 -1.738244 _Isymm_3 | -1.232144 .1372924 -8.97 0.000 -1.501232 -.9630555 _Isymm_4 | -.8266786 .1219875 -6.78 0.000 -1.06577 -.5875874 _Isymm_5 | -3.583519 .5068969 -7.07 0.000 -4.577019 -2.590019 _Isymm_6 | -2.890372 .2635231 -10.97 0.000 -3.406868 -2.373876 _Isymm_7 | -2.295665 .2035367 -11.28 0.000 -2.694589 -1.89674 _Isymm_8 | -3.178054 .4166667 -7.63 0.000 -3.994705 -2.361402 _Isymm_9 | -2.404864 .2130868 -11.29 0.000 -2.822506 -1.987221 _Isymm_10 | -3.360375 .4549115 -7.39 0.000 -4.251985 -2.468765 _cons | 4.969813 .0833333 59.64 0.000 4.806483 5.133144 ------------------------------------------------------------------------------ xi: glm count i.p1 i.p2 i.symm, fam(poi) nolog /*quasi-symmetry*/ i.p1 _Ip1_1-4 (naturally coded; _Ip1_1 omitted) i.p2 _Ip2_1-4 (naturally coded; _Ip2_1 omitted) i.symm _Isymm_1-10 (naturally coded; _Isymm_1 omitted) note: _Isymm_5 dropped due to collinearity note: _Isymm_8 dropped due to collinearity note: _Isymm_10 dropped due to collinearity Generalized linear models No. of obs = 16 Optimization : ML: Newton-Raphson Residual df = 3 Scale parameter = 1 Deviance = 1.364550248 (1/df) Deviance = .4548501 Pearson = .8683363489 (1/df) Pearson = .2894454 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -29.42666302 AIC = 5.303333 BIC = -6.953215918 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Ip1_2 | -.2652152 .4479877 -0.59 0.554 -1.143255 .6128245 _Ip1_3 | 1.080925 .5104393 2.12 0.034 .0804828 2.081368 _Ip1_4 | 2.667576 .7041824 3.79 0.000 1.287403 4.047748 _Ip2_2 | -3.318304 .4479877 -7.41 0.000 -4.196343 -2.440264 _Ip2_3 | -4.258979 .5104393 -8.34 0.000 -5.259422 -3.258537 _Ip2_4 | -6.027951 .7041824 -8.56 0.000 -7.408123 -4.647779 _Isymm_2 | -1.195382 .4536139 -2.64 0.008 -2.084449 -.3063153 _Isymm_3 | -1.624707 .5180026 -3.14 0.002 -2.639973 -.6094404 _Isymm_4 | -2.801274 .709586 -3.95 0.000 -4.192037 -1.410511 _Isymm_6 | -.0566003 .5112585 -0.11 0.912 -1.058649 .945448 _Isymm_7 | -.9553273 .7136538 -1.34 0.181 -2.354063 .4434084 _Isymm_9 | -.154606 .5967923 -0.26 0.796 -1.324297 1.015085 _cons | 4.969813 .0833333 59.64 0.000 4.806483 5.133144 ------------------------------------------------------------------------------ xi: glm count p1 i.symm, fam(poi) nolog /*ordinal quasi-symmetry*/ i.symm _Isymm_1-10 (naturally coded; _Isymm_1 omitted) Generalized linear models No. of obs = 16 Optimization : ML: Newton-Raphson Residual df = 5 Scale parameter = 1 Deviance = 2.097209206 (1/df) Deviance = .4194418 Pearson = 2.084385929 (1/df) Pearson = .4168772 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -29.7929925 AIC = 5.099124 BIC = -11.7657344 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- p1 | 2.856564 .4205179 6.79 0.000 2.032364 3.680764 _Isymm_2 | -4.326905 .4400612 -9.83 0.000 -5.189409 -3.4644 _Isymm_3 | -6.255421 .8494362 -7.36 0.000 -7.920286 -4.590557 _Isymm_4 | -8.703413 1.2672 -6.87 0.000 -11.18708 -6.219747 _Isymm_5 | -6.440083 .6586196 -9.78 0.000 -7.730954 -5.149212 _Isymm_6 | -7.966228 .8595749 -9.27 0.000 -9.650964 -6.281492 _Isymm_7 | -10.17551 1.275135 -7.98 0.000 -12.67472 -7.676288 _Isymm_8 | -8.891182 .9385907 -9.47 0.000 -10.73079 -7.051578 _Isymm_9 | -10.33728 1.256896 -8.22 0.000 -12.80076 -7.873813 _Isymm_10 | -11.93007 1.341068 -8.90 0.000 -14.55851 -9.301623 _cons | 2.113249 .4286954 4.93 0.000 1.273022 2.953477 ------------------------------------------------------------------------------ predict p (option mu assumed; predicted mean count) format p %5.2f table p1 p2, c(mean count mean p) ------------------------------------------ | p2 p1 | 1 2 3 4 ----------+------------------------------- 1 | 144 2 0 0 | 144.00 1.90 0.28 0.02 | 2 | 33 4 2 0 | 33.10 4.00 0.87 0.10 | 3 | 84 14 6 1 | 83.72 15.13 6.00 1.41 | 4 | 126 29 25 5 | 125.98 28.90 24.59 5.00 ------------------------------------------
Section 9.4.1 Testing Marginal Homogeneity on page 239.
The fitstat command needs to be downloaded prior to its use, which can be done by typing search fitstat in the command line (see How can I use the search command to search for programs and get additional help? for more information about using search).
use https://stats.idre.ucla.edu/stat/stata/examples/icda/coffee, clear quietly xi: poisson count i.p1 i.p2 i.symm fitstat, saving(m0) Measures of Fit for poisson of count Log-Lik Intercept Only: -436.541 Log-Lik Full Model: -57.256 D(6): 114.511 LR(18): 758.570 Prob > LR: 0.000 McFadden's R2: 0.869 McFadden's Adj R2: 0.825 Maximum Likelihood R2: 1.000 Cragg & Uhler's R2: 1.000 AIC: 6.100 AIC*n: 152.511 BIC: 95.198 BIC': -700.631 (Indices saved in matrix fs_m0) quietly xi: poisson count i.symm fitstat, using(m0) Measures of Fit for poisson of count Current Saved Difference Model: poisson poisson N: 25 25 0 Log-Lik Intercept Only: -436.541 -436.541 0.000 Log-Lik Full Model: -63.505 -57.256 -6.249 D: 127.010(10) 114.511(6) 12.499(4) LR: 746.071(14) 758.570(18) 12.499(4) Prob > LR: 0.000 0.000 0.014 McFadden's R2: 0.855 0.869 -0.014 McFadden's Adj R2: 0.820 0.825 -0.005 Maximum Likelihood R2: 1.000 1.000 -0.000 Cragg & Uhler's R2: 1.000 1.000 -0.000 AIC: 6.280 6.100 0.180 AIC*n: 157.010 152.511 4.499 BIC: 94.821 95.198 -0.377 BIC': -701.007 -700.631 -0.377 Difference of 0.377 in BIC' provides weak support for current model. Note: p-value for difference in LR is only valid if models are nested. tab p1 p2 [fw=count], row col +-------------------+ | Key | |-------------------| | frequency | | row percentage | | column percentage | +-------------------+ | p2 p1 | High Poin Taster's Sanka Nescafe Brim | Total -----------+-------------------------------------------------------+---------- High Point | 93 17 44 7 10 | 171 | 54.39 9.94 25.73 4.09 5.85 | 100.00 | 68.89 20.73 19.05 21.21 16.67 | 31.61 -----------+-------------------------------------------------------+---------- Taster's | 9 46 11 0 9 | 75 | 12.00 61.33 14.67 0.00 12.00 | 100.00 | 6.67 56.10 4.76 0.00 15.00 | 13.86 -----------+-------------------------------------------------------+---------- Sanka | 17 11 155 9 12 | 204 | 8.33 5.39 75.98 4.41 5.88 | 100.00 | 12.59 13.41 67.10 27.27 20.00 | 37.71 -----------+-------------------------------------------------------+---------- Nescafe | 6 4 9 15 2 | 36 | 16.67 11.11 25.00 41.67 5.56 | 100.00 | 4.44 4.88 3.90 45.45 3.33 | 6.65 -----------+-------------------------------------------------------+---------- Brim | 10 4 12 2 27 | 55 | 18.18 7.27 21.82 3.64 49.09 | 100.00 | 7.41 4.88 5.19 6.06 45.00 | 10.17 -----------+-------------------------------------------------------+---------- Total | 135 82 231 33 60 | 541 | 24.95 15.16 42.70 6.10 11.09 | 100.00 | 100.00 100.00 100.00 100.00 100.00 | 100.00 gen p1hi = (p1==1) gen p2hi = (p2 ==1) mcc p1hi p2hi [fw=count] | Controls | Cases | Exposed Unexposed | Total -----------------+------------------------+---------- Exposed | 93 78 | 171 Unexposed | 42 328 | 370 -----------------+------------------------+---------- Total | 135 406 | 541 McNemar's chi2(1) = 10.80 Prob > chi2 = 0.0010 Exact McNemar significance probability = 0.0013 Proportion with factor Cases .3160813 Controls .2495379 [95% Conf. Interval] --------- -------------------- difference .0665434 .0254068 .1076801 ratio 1.266667 1.099745 1.458924 rel. diff. .08867 .0381863 .1391536 odds ratio 1.857143 1.260425 2.770706 (exact) di sqrt(r(chi2)) 3.2863353
Section 9.4.2 Marginal Homogeneity and Ordered Categories on page 241.
use https://stats.idre.ucla.edu/stat/stata/examples/icda/marital, clear xi: poisson count p1 i.symm /*ordinal quasi-symmetry*/ i.symm _Isymm_1-10 (naturally coded; _Isymm_1 omitted) Poisson regression Number of obs = 16 LR chi2(10) = 886.28 Prob > chi2 = 0.0000 Log likelihood = -29.792992 Pseudo R2 = 0.9370 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- p1 | 2.856564 .420518 6.79 0.000 2.032364 3.680764 _Isymm_2 | -4.326905 .4400613 -9.83 0.000 -5.189409 -3.4644 _Isymm_3 | -6.255422 .8494362 -7.36 0.000 -7.920286 -4.590557 _Isymm_4 | -8.703413 1.2672 -6.87 0.000 -11.18708 -6.219748 _Isymm_5 | -6.440083 .6586196 -9.78 0.000 -7.730954 -5.149212 _Isymm_6 | -7.966228 .8595749 -9.27 0.000 -9.650964 -6.281492 _Isymm_7 | -10.17551 1.275135 -7.98 0.000 -12.67472 -7.676289 _Isymm_8 | -8.891182 .9385907 -9.47 0.000 -10.73079 -7.051578 _Isymm_9 | -10.33728 1.256896 -8.22 0.000 -12.80076 -7.873813 _Isymm_10 | -11.93007 1.341068 -8.90 0.000 -14.55851 -9.301623 _cons | 2.113249 .4286955 4.93 0.000 1.273022 2.953477 ------------------------------------------------------------------------------ fitstat, saving(moqs) Measures of Fit for poisson of count Log-Lik Intercept Only: -472.933 Log-Lik Full Model: -29.793 D(5): 59.586 LR(10): 886.281 Prob > LR: 0.000 McFadden's R2: 0.937 McFadden's Adj R2: 0.914 Maximum Likelihood R2: 1.000 Cragg & Uhler's R2: 1.000 AIC: 5.099 AIC*n: 81.586 BIC: 45.723 BIC': -858.555 (Indices saved in matrix fs_moqs) xi: poisson count i.symm /*symmetry*/ i.symm _Isymm_1-10 (naturally coded; _Isymm_1 omitted) Poisson regression Number of obs = 16 LR chi2(9) = 486.17 Prob > chi2 = 0.0000 Log likelihood = -229.84582 Pseudo R2 = 0.5140 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Isymm_2 | -2.107612 .1884566 -11.18 0.000 -2.47698 -1.738244 _Isymm_3 | -1.232144 .1372924 -8.97 0.000 -1.501232 -.9630555 _Isymm_4 | -.8266786 .1219875 -6.78 0.000 -1.06577 -.5875874 _Isymm_5 | -3.583519 .5068969 -7.07 0.000 -4.577019 -2.590019 _Isymm_6 | -2.890372 .2635231 -10.97 0.000 -3.406868 -2.373876 _Isymm_7 | -2.295665 .2035367 -11.28 0.000 -2.694589 -1.89674 _Isymm_8 | -3.178054 .4166667 -7.63 0.000 -3.994705 -2.361402 _Isymm_9 | -2.404864 .2130868 -11.29 0.000 -2.822506 -1.987221 _Isymm_10 | -3.360375 .4549115 -7.39 0.000 -4.251985 -2.468765 _cons | 4.969813 .0833333 59.64 0.000 4.806483 5.133144 ------------------------------------------------------------------------------ fitstat, using(moqs) Measures of Fit for poisson of count Current Saved Difference Model: poisson poisson N: 16 16 0 Log-Lik Intercept Only: -472.933 -472.933 0.000 Log-Lik Full Model: -229.846 -29.793 -200.053 D: 459.692(6) 59.586(5) 400.106(1) LR: 486.175(9) 886.281(10) 400.106(1) Prob > LR: 0.000 0.000 0.000 McFadden's R2: 0.514 0.937 -0.423 McFadden's Adj R2: 0.493 0.914 -0.421 Maximum Likelihood R2: 1.000 1.000 -0.000 Cragg & Uhler's R2: 1.000 1.000 -0.000 AIC: 29.981 5.099 24.882 AIC*n: 479.692 81.586 398.106 BIC: 443.056 45.723 397.333 BIC': -461.222 -858.555 397.333 Difference of 397.333 in BIC' provides very strong support for saved model. Note: p-value for difference in LR is only valid if models are nested. xi: poisson count p1 i.symm /*ordinal quasi-symmetry*/ Poisson regression Number of obs = 16 LR chi2(10) = 886.28 Prob > chi2 = 0.0000 Log likelihood = -29.792992 Pseudo R2 = 0.9370 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- p1 | 2.856564 .420518 6.79 0.000 2.032364 3.680764 _Isymm_2 | -4.326905 .4400613 -9.83 0.000 -5.189409 -3.4644 _Isymm_3 | -6.255422 .8494362 -7.36 0.000 -7.920286 -4.590557 _Isymm_4 | -8.703413 1.2672 -6.87 0.000 -11.18708 -6.219748 _Isymm_5 | -6.440083 .6586196 -9.78 0.000 -7.730954 -5.149212 _Isymm_6 | -7.966228 .8595749 -9.27 0.000 -9.650964 -6.281492 _Isymm_7 | -10.17551 1.275135 -7.98 0.000 -12.67472 -7.676289 _Isymm_8 | -8.891182 .9385907 -9.47 0.000 -10.73079 -7.051578 _Isymm_9 | -10.33728 1.256896 -8.22 0.000 -12.80076 -7.873813 _Isymm_10 | -11.93007 1.341068 -8.90 0.000 -14.55851 -9.301623 _cons | 2.113249 .4286955 4.93 0.000 1.273022 2.953477 ------------------------------------------------------------------------------ test p1 ( 1) [count]p1 = 0 chi2( 1) = 46.14 Prob > chi2 = 0.0000
Section 9.4.3 A Proportional Odds Comparison of Margins on page 241-242.
clear input score below above trials 1 33 2 35 1 14 2 16 1 25 1 26 2 84 0 84 2 29 0 29 3 126 0 126 end glm above [fw=score], fam(bin trials) Generalized linear models No. of obs = 10 Optimization : ML: Newton-Raphson Residual df = 9 Scale parameter = 1 Deviance = 23.23829262 (1/df) Deviance = 2.582033 Pearson = 50.22291971 (1/df) Pearson = 5.580324 Variance function: V(u) = u*(1-u/trials) [Binomial] Link function : g(u) = ln(u/(trials-u)) [Logit] Standard errors : OIM Log likelihood = -15.11807183 AIC = 3.223614 BIC = 2.515026785 ------------------------------------------------------------------------------ above | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | -4.906755 .4488644 -10.93 0.000 -5.786513 -4.026997 ------------------------------------------------------------------------------ di exp(-4.906755) .00739645
Section 9.5.1 Quasi Independence and Table 9.7 on page 242.
use https://stats.idre.ucla.edu/stat/stata/examples/icda/carcinoma, clear xi: glm count i.px i.py, fam(poi) i.px _Ipx_1-4 (naturally coded; _Ipx_1 omitted) i.py _Ipy_1-4 (naturally coded; _Ipy_1 omitted) Generalized linear models No. of obs = 16 Optimization : ML: Newton-Raphson Residual df = 9 Scale parameter = 1 Deviance = 117.9568605 (1/df) Deviance = 13.10632 Pearson = 120.2634516 (1/df) Pearson = 13.36261 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -79.38776817 AIC = 10.79847 BIC = 93.00356204 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Ipx_2 | -4.07e-08 .2773501 -0.00 1.000 -.5435962 .5435962 _Ipx_3 | .3794896 .2545139 1.49 0.136 -.1193485 .8783277 _Ipx_4 | .0741079 .2723524 0.27 0.786 -.4596929 .6079088 _Ipy_2 | -.8109302 .3469443 -2.34 0.019 -1.490929 -.1309318 _Ipy_3 | .9382696 .2270017 4.13 0.000 .4933544 1.383185 _Ipy_4 | -.9932518 .3701851 -2.68 0.007 -1.718801 -.2677022 _cons | 1.783249 .2588899 6.89 0.000 1.275834 2.290664 ------------------------------------------------------------------------------
The tabchi command needs to be downloaded prior to its use, which can be done by typing search tabchi in the command line (see How can I use the search command to search for programs and get additional help? for more information about using search).
tabchi px py [fw=count], a noe observed frequency adjusted residual ------------------------------------------ | py px | 1 2 3 4 ----------+------------------------------- 1 | 22 2 2 0 | 8.487 -0.473 -5.951 -1.757 | 2 | 5 7 14 0 | -0.502 3.201 -0.542 -1.757 | 3 | 0 2 36 0 | -4.078 -1.215 5.509 -2.278 | 4 | 0 1 17 10 | -3.300 -1.323 0.275 5.926 ------------------------------------------ 8 cells with expected frequency < 5 Pearson chi2(9) = 120.2635 Pr = 0.000 likelihood-ratio chi2(9) = . Pr = . xi: glm count i.px i.py i.qs, fam(poi) i.px _Ipx_1-4 (naturally coded; _Ipx_1 omitted) i.py _Ipy_1-4 (naturally coded; _Ipy_1 omitted) i.qs _Iqs_1-5 (naturally coded; _Iqs_1 omitted) Generalized linear models No. of obs = 16 Optimization : ML: Newton-Raphson Residual df = 5 Scale parameter = 1 Deviance = 13.17806287 (1/df) Deviance = 2.635613 Pearson = 11.52236291 (1/df) Pearson = 2.304473 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -26.99836934 AIC = 4.749796 BIC = -.6848807377 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Ipx_2 | 1.631969 .560423 2.91 0.004 .5335598 2.730377 _Ipx_3 | .5016421 .9260906 0.54 0.588 -1.313462 2.316746 _Ipx_4 | 1.394444 .5550495 2.51 0.012 .3065673 2.482321 _Ipy_2 | .4796116 .655163 0.73 0.464 -.8044843 1.763707 _Ipy_3 | 1.949173 .4970561 3.92 0.000 .9749608 2.923385 _Ipy_4 | -16.2392 1771.65 -0.01 0.993 -3488.609 3456.13 _Iqs_2 | -3.256746 1.033483 -3.15 0.002 -5.282336 -1.231157 _Iqs_3 | -1.958314 1.188863 -1.65 0.100 -4.288441 .3718142 _Iqs_4 | 14.05626 1771.65 0.01 0.994 -3458.314 3486.426 _Iqs_5 | -3.860885 .7296819 -5.29 0.000 -5.291036 -2.430735 _cons | 3.091077 .2131971 14.50 0.000 2.673218 3.508935 ------------------------------------------------------------------------------ use https://stats.idre.ucla.edu/stat/stata/examples/icda/coffee, clear xi: glm count i.p1 i.p2 i.qs, fam(poi) i.p1 _Ip1_1-5 (naturally coded; _Ip1_1 omitted) i.p2 _Ip2_1-5 (naturally coded; _Ip2_1 omitted) i.qs _Iqs_1-6 (naturally coded; _Iqs_1 omitted) Generalized linear models No. of obs = 25 Optimization : ML: Newton-Raphson Residual df = 11 Scale parameter = 1 Deviance = 13.78562612 (1/df) Deviance = 1.253239 Pearson = 12.24792024 (1/df) Pearson = 1.113447 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -59.16136962 AIC = 5.85291 BIC = -21.62200795 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Ip1_2 | -1.110158 .22572 -4.92 0.000 -1.552561 -.6677549 _Ip1_3 | -.2471955 .2080429 -1.19 0.235 -.6549521 .160561 _Ip1_4 | -1.521394 .2515045 -6.05 0.000 -2.014333 -1.028454 _Ip1_5 | -1.161002 .2280781 -5.09 0.000 -1.608026 -.7139767 _Ip2_2 | -.4965487 .2381542 -2.08 0.037 -.9633223 -.0297751 _Ip2_3 | .4678636 .2187364 2.14 0.032 .0391481 .8965791 _Ip2_4 | -1.236619 .2896265 -4.27 0.000 -1.804277 -.6689617 _Ip2_5 | -.5905986 .2431813 -2.43 0.015 -1.067225 -.1139721 _Iqs_2 | .9027485 .4100027 2.20 0.028 .0991581 1.706339 _Iqs_3 | .2901575 .3893074 0.75 0.456 -.472871 1.053186 _Iqs_4 | .9334636 .50043 1.87 0.062 -.0473612 1.914288 _Iqs_5 | .5148376 .4318692 1.19 0.233 -.3316104 1.361286 _Iqs_6 | -1.29089 .2460296 -5.25 0.000 -1.773099 -.8086812 _cons | 4.532599 .1036952 43.71 0.000 4.329361 4.735838 ------------------------------------------------------------------------------ xi: glm count i.p1 i.p2 , fam(poi) i.p1 _Ip1_1-5 (naturally coded; _Ip1_1 omitted) i.p2 _Ip2_1-5 (naturally coded; _Ip2_1 omitted) Generalized linear models No. of obs = 25 Optimization : ML: Newton-Raphson Residual df = 16 Scale parameter = 1 Deviance = 346.3809793 (1/df) Deviance = 21.64881 Pearson = 463.3043939 (1/df) Pearson = 28.95652 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -225.4590462 AIC = 18.75672 BIC = 294.8789661 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Ip1_2 | -.8241754 .1384965 -5.95 0.000 -1.095624 -.5527273 _Ip1_3 | .1764564 .1036818 1.70 0.089 -.0267561 .379669 _Ip1_4 | -1.558145 .1833732 -8.50 0.000 -1.917549 -1.19874 _Ip1_5 | -1.13433 .1550154 -7.32 0.000 -1.438155 -.8305058 _Ip2_2 | -.4985555 .140009 -3.56 0.000 -.7729682 -.2241429 _Ip2_3 | .5371429 .1083347 4.96 0.000 .3248108 .7494751 _Ip2_4 | -1.408767 .1941917 -7.25 0.000 -1.789376 -1.028158 _Ip2_5 | -.8109302 .1551582 -5.23 0.000 -1.115035 -.5068257 _cons | 3.753519 .1068032 35.14 0.000 3.544189 3.96285 ------------------------------------------------------------------------------
Section 9.5.2 Summarizing Agreement on page 244.
use https://stats.idre.ucla.edu/stat/stata/examples/icda/carcinoma, clear char qs[omit] xi: glm count i.px i.py i.qs, fam(poi) i.px _Ipx_1-4 (naturally coded; _Ipx_1 omitted) i.py _Ipy_1-4 (naturally coded; _Ipy_1 omitted) i.qs _Iqs_1-5 (naturally coded; _Iqs_5 omitted) Generalized linear models No. of obs = 16 Optimization : ML: Newton-Raphson Residual df = 5 Scale parameter = 1 Deviance = 13.17806287 (1/df) Deviance = 2.635613 Pearson = 11.52236291 (1/df) Pearson = 2.304473 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -26.99836934 AIC = 4.749796 BIC = -.6848807377 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Ipx_2 | 1.631969 .560423 2.91 0.004 .5335598 2.730377 _Ipx_3 | .5016421 .9260906 0.54 0.588 -1.313462 2.316746 _Ipx_4 | 1.394444 .5550495 2.51 0.012 .3065673 2.482321 _Ipy_2 | .4796116 .655163 0.73 0.464 -.8044843 1.763707 _Ipy_3 | 1.949173 .4970561 3.92 0.000 .9749608 2.923385 _Ipy_4 | -16.2392 1771.65 -0.01 0.993 -3488.609 3456.13 _Iqs_1 | 3.860885 .7296819 5.29 0.000 2.430735 5.291036 _Iqs_2 | .6041388 .6899838 0.88 0.381 -.7482046 1.956482 _Iqs_3 | 1.902572 .8367 2.27 0.023 .2626698 3.542473 _Iqs_4 | 17.91715 1771.65 0.01 0.992 -3454.452 3490.287 _cons | -.7698087 .6978414 -1.10 0.270 -2.137553 .5979354 ------------------------------------------------------------------------------
Section 9.5.3 Quasi Symmetry and Agreement Modeling on page 245.
use https://stats.idre.ucla.edu/stat/stata/examples/icda/carcinoma, clear xi: glm count i.px i.py i.symm, fam(poi) nolog i.px _Ipx_1-4 (naturally coded; _Ipx_1 omitted) i.py _Ipy_1-4 (naturally coded; _Ipy_1 omitted) i.symm _Isymm_1-10 (naturally coded; _Isymm_1 omitted) note: _Isymm_5 dropped due to collinearity note: _Isymm_8 dropped due to collinearity note: _Isymm_10 dropped due to collinearity Generalized linear models No. of obs = 16 Optimization : ML: Newton-Raphson Residual df = 3 Scale parameter = 1 Deviance = .978304658 (1/df) Deviance = .3261016 Pearson = .621982784 (1/df) Pearson = .2073276 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -20.89849023 AIC = 4.237311 BIC = -7.339461509 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Ipx_2 | -.2360635 .430017 -0.55 0.583 -1.078881 .6067543 _Ipx_3 | -.5038594 .5050534 -1.00 0.318 -1.493746 .486027 _Ipx_4 | 8.229144 1131.109 0.01 0.994 -2208.703 2225.161 _Ipy_2 | -.9090505 .430017 -2.11 0.035 -1.751868 -.0662327 _Ipy_3 | .9963219 .5050534 1.97 0.049 .0064355 1.986208 _Ipy_4 | -9.017585 1131.109 -0.01 0.994 -2225.95 2207.915 _Isymm_2 | -1.321299 .4521483 -2.92 0.003 -2.207493 -.4351046 _Isymm_3 | -3.595678 .783512 -4.59 0.000 -5.131334 -2.060023 _Isymm_4 | -27.11437 2775.396 -0.01 0.992 -5466.791 5412.562 _Isymm_6 | -1.186505 .4441345 -2.67 0.008 -2.056992 -.3160173 _Isymm_7 | -10.41121 1131.109 -0.01 0.993 -2227.344 2206.522 _Isymm_9 | -9.48327 1131.109 -0.01 0.993 -2226.415 2207.449 _cons | 3.091024 .2132027 14.50 0.000 2.673155 3.508894 ------------------------------------------------------------------------------ predict psymm (option mu assumed; predicted mean count) xi: glm count i.px i.py i.qs, fam(poi) nolog i.px _Ipx_1-4 (naturally coded; _Ipx_1 omitted) i.py _Ipy_1-4 (naturally coded; _Ipy_1 omitted) i.qs _Iqs_1-5 (naturally coded; _Iqs_5 omitted) Generalized linear models No. of obs = 16 Optimization : ML: Newton-Raphson Residual df = 5 Scale parameter = 1 Deviance = 13.17806287 (1/df) Deviance = 2.635613 Pearson = 11.52236291 (1/df) Pearson = 2.304473 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -26.99836934 AIC = 4.749796 BIC = -.6848807377 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Ipx_2 | 1.631969 .560423 2.91 0.004 .5335598 2.730377 _Ipx_3 | .5016421 .9260906 0.54 0.588 -1.313462 2.316746 _Ipx_4 | 1.394444 .5550495 2.51 0.012 .3065673 2.482321 _Ipy_2 | .4796116 .655163 0.73 0.464 -.8044843 1.763707 _Ipy_3 | 1.949173 .4970561 3.92 0.000 .9749608 2.923385 _Ipy_4 | -16.2392 1771.65 -0.01 0.993 -3488.609 3456.13 _Iqs_1 | 3.860885 .7296819 5.29 0.000 2.430735 5.291036 _Iqs_2 | .6041388 .6899838 0.88 0.381 -.7482046 1.956482 _Iqs_3 | 1.902572 .8367 2.27 0.023 .2626698 3.542473 _Iqs_4 | 17.91715 1771.65 0.01 0.992 -3454.452 3490.287 _cons | -.7698087 .6978414 -1.10 0.270 -2.137553 .5979354 ------------------------------------------------------------------------------ predict pqs (option mu assumed; predicted mean count) table px py, con(sum count sum pqs sum psymm) -------------------------------------------------- | py px | 1 2 3 4 ----------+--------------------------------------- 1 | 22 2 2 0 | 22.00075 .7481161 3.252306 4.10e-08 | 21.9996 2.364755 1.63504 4.47e-15 | 2 | 5 7 14 0 | 2.36827 7.000001 16.63207 2.10e-07 | 4.635118 7 14.36476 6.34e-08 | 3 | 0 2 36 0 | .7647803 1.235462 36.00212 6.78e-08 | .3647607 1.634945 35.99884 1.23e-07 | 4 | 0 1 17 10 | 1.867565 3.016952 13.11568 10.00003 | 1.38e-07 .9999095 17.00012 9.999983 -------------------------------------------------- xi: glm count i.symm, fam(poi) nolog i.symm _Isymm_1-10 (naturally coded; _Isymm_1 omitted) Generalized linear models No. of obs = 16 Optimization : ML: Newton-Raphson Residual df = 6 Scale parameter = 1 Deviance = 39.17823839 (1/df) Deviance = 6.529706 Pearson = 30.2854683 (1/df) Pearson = 5.047578 Variance function: V(u) = u [Poisson] Link function : g(u) = ln(u) [Log] Standard errors : OIM Log likelihood = -39.9984571 AIC = 6.249807 BIC = 22.54270606 ------------------------------------------------------------------------------ count | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _Isymm_2 | -1.838279 .4339457 -4.24 0.000 -2.688797 -.9877615 _Isymm_3 | -3.091058 .7385487 -4.19 0.000 -4.538587 -1.643529 _Isymm_4 | -20.03611 3381.085 -0.01 0.995 -6646.842 6606.769 _Isymm_5 | -1.145147 .4339482 -2.64 0.008 -1.99567 -.2946244 _Isymm_6 | -1.011603 .3285621 -3.08 0.002 -1.655573 -.3676328 _Isymm_7 | -3.78444 1.02259 -3.70 0.000 -5.788679 -1.780201 _Isymm_8 | .4924818 .2706124 1.82 0.069 -.0379088 1.022872 _Isymm_9 | -.950971 .3229183 -2.94 0.003 -1.583879 -.3180628 _Isymm_10 | -.7884702 .3813839 -2.07 0.039 -1.535969 -.0409715 _cons | 3.091057 .2131991 14.50 0.000 2.673195 3.50892 ------------------------------------------------------------------------------
Section 9.5.4 Kappa Measure of Agreement on page 246.
use https://stats.idre.ucla.edu/stat/stata/examples/icda/carcinoma, clear kap px py [fw=count] Expected Agreement Agreement Kappa Std. Err. Z Prob>Z ----------------------------------------------------------------- 63.56% 28.12% 0.4930 0.0501 9.83 0.0000
Section 9.6.1 The Bradley-Terry Model on page 247.
clear input wins matches seles graf sabat navrat sanchez 2 5 1 -1 0 0 0 1 1 1 0 -1 0 0 3 6 1 0 0 -1 0 2 2 1 0 0 0 -1 6 9 0 1 -1 0 0 3 3 0 1 0 -1 0 7 8 0 1 0 0 -1 1 3 0 0 1 -1 0 3 5 0 0 1 0 -1 3 4 0 0 0 1 -1 end glm wins seles graf sabat navrat sanchez, fam(bin matches) nocons note: sanchez dropped due to collinearity Generalized linear models No. of obs = 10 Optimization : ML: Newton-Raphson Residual df = 6 Scale parameter = 1 Deviance = 4.649258673 (1/df) Deviance = .7748764 Pearson = 3.204827193 (1/df) Pearson = .5341379 Variance function: V(u) = u*(1-u/matches) [Binomial] Link function : g(u) = ln(u/(matches-u)) [Logit] Standard errors : OIM Log likelihood = -9.519233528 AIC = 2.703847 BIC = -9.166251885 ------------------------------------------------------------------------------ wins | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- seles | 1.533144 .7870659 1.95 0.051 -.0094769 3.075765 graf | 1.932784 .6783673 2.85 0.004 .6032082 3.262359 sabat | .7308542 .6771022 1.08 0.280 -.5962416 2.05795 navrat | 1.087506 .7236525 1.50 0.133 -.3308268 2.505839 ------------------------------------------------------------------------------ lincom graf-seles ( 1) - [wins]seles + [wins]graf = 0 ------------------------------------------------------------------------------ wins | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | .3996396 .6689474 0.60 0.550 -.9114732 1.710752 ------------------------------------------------------------------------------ predict pwins (option mu assumed; predicted mean wins) list +---------------------------------------------------------------------+ | wins matches seles graf sabat navrat sanchez pwins | |---------------------------------------------------------------------| 1. | 2 5 1 -1 0 0 0 2.006995 | 2. | 1 1 1 0 -1 0 0 .6904641 | 3. | 3 6 1 0 0 -1 0 3.65761 | 4. | 2 2 1 0 0 0 -1 1.644932 | 5. | 6 9 0 1 -1 0 0 6.91981 | |---------------------------------------------------------------------| 6. | 3 3 0 1 0 -1 0 2.098727 | 7. | 7 8 0 1 0 0 -1 6.988458 | 8. | 1 3 0 0 1 -1 0 1.235311 | 9. | 3 5 0 0 1 0 -1 3.374964 | 10. | 3 4 0 0 0 1 -1 2.991647 | +---------------------------------------------------------------------+