Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: RE: RE: Re: Loglinear quasi-symmetric agreement

 From Martyn Sherriff To statalist@hsphsun2.harvard.edu Subject Re: st: RE: RE: Re: Loglinear quasi-symmetric agreement Date Thu, 7 Jun 2012 22:21:41 +0100

```I am now more confused than normal. Basically can I use 'factor
notation' with glm?

Usin the ATS dataset I get:
. 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 because of collinearity
note: _Isymm_8 dropped because of collinearity
note: _Isymm_10 dropped because of collinearity

Generalized linear models                          No. of obs      =        16
Optimization     : ML                              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]

AIC             =  4.237311
Log likelihood   = -20.89849023                    BIC             = -7.339462

------------------------------------------------------------------------------
|                 OIM
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
------------------------------------------------------------------------------
Which seems to me to be reasonable.

But if I omit the xi (which I thought I could do in Stata 12) I get:

. glm count i.px i.py i.symm, fam(poi) nolog
note: 7.symm omitted because of collinearity
note: 9.symm omitted because of collinearity
note: 10.symm omitted because of collinearity

Generalized linear models                          No. of obs      =        16
Optimization     : ML                              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]

AIC             =  4.237311
Log likelihood   = -20.89849023                    BIC             = -7.339462

------------------------------------------------------------------------------
|                 OIM
count |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
px |
2  |  -10.64727   1131.109    -0.01   0.992     -2227.58    2206.286
3  |  -9.987129   1131.109    -0.01   0.993     -2226.92    2206.945
4  |   8.229144   1131.109     0.01   0.994    -2208.703    2225.161
|
py |
2  |  -11.32026   1131.109    -0.01   0.992    -2228.253    2205.613
3  |  -8.486948   1131.109    -0.01   0.994    -2225.419    2208.445
4  |  -9.017585   1131.109    -0.01   0.994     -2225.95    2207.915
|
symm |
2  |   9.089909   1131.109     0.01   0.994    -2207.843    2226.023
3  |   5.887591   1131.109     0.01   0.996    -2211.045     2222.82
4  |  -27.11437   2775.396    -0.01   0.992    -5466.791    5412.562
5  |   20.82242   2262.218     0.01   0.993    -4413.043    4454.688
6  |   18.70797   2262.217     0.01   0.993    -4415.157    4452.573
7  |          0  (omitted)
8  |   18.96654   2262.217     0.01   0.993    -4414.898    4452.831
9  |          0  (omitted)
10  |          0  (omitted)
|
_cons |   3.091024   .2132027    14.50   0.000     2.673155    3.508894
------------------------------------------------------------------------------

I have probably missed it, but I cannot find anything in the
documentation related to factor that says that I cannot use it with
glm, or does it produce a different parametrisation, or am  I missing
something that is obvious?

My Stata update is
Update status
Last check for updates:  07 Jun 2012
New update available:    none         (as of 07 Jun 2012)
Current update level:    23 May 2012  (what's new)

Thanks,
Martyn

On 7 June 2012 20:52, Martyn Sherriff <statams48@gmail.com> wrote:
> Shaun, thank you for the link. I will follow it up and see whatI can find.
> Cheers,
> Martyn
>
> On 7 June 2012 18:19, Scholes, Shaun <s.scholes@ucl.ac.uk> wrote:
>> Actually, this appears to give different results:
>>
>> version 9
>> use http://www.ats.ucla.edu/stat/stata/examples/icda/carcinoma, clear
>> xi: glm count i.px i.py i.symm, fam(poi) nolog
>>
>> hope this helps
>> best wishes
>> Shaun
>>
>>
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Scholes, Shaun
>> Sent: 07 June 2012 18:07
>> To: statalist@hsphsun2.harvard.edu
>> Subject: st: RE: Re: Loglinear quasi-symmetric agreement
>>
>> Martyn, I can't help you with your question but it may be worth taking a close look at:
>>
>> http://www.ats.ucla.edu/stat/stata/examples/icda/icdast9.htm
>>
>> Best wishes
>> Shaun
>>
>>
>>
>> -----Original Message-----
>> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martyn Sherriff
>> Sent: 07 June 2012 16:24
>> To: statalist@hsphsun2.harvard.edu
>> Subject: st: Re: Loglinear quasi-symmetric agreement
>>
>> I am trying to use loglinear models to assess agreement using the quasi-symmetry model and have used the data from Agresti (An Introduction to Categorical Analysis, p 245) to check my method.
>>
>>     +-------------------------+
>>     | px   py   count   qasym |
>>     |-------------------------|
>>  1. |  1    1      22       1 |
>>  2. |  1    2       2        2 |
>>  3. |  1    3       2        3 |
>>  4. |  1    4       0        4 |
>>  5. |  2    1       5        2 |
>>     |-------------------------|
>>  6. |  2    2       7        5 |
>>  7. |  2    3      14       6 |
>>  8. |  2    4       0        7 |
>>  9. |  3    1       0        3 |
>>  10. |  3    2       2       6 |
>>     |-------------------------|
>>  11. |  3    3      36       8 |
>>  12. |  3    4       0        9 |
>>  13. |  4    1       0        4 |
>>  14. |  4    2       1        7 |
>>  15. |  4    3      17       9 |
>>     |-------------------------|
>>  16. |  4    4      10      10 |
>>     +-------------------------+
>>
>> The simple symmetry model is satisfactory:
>>  glm count i.px i.py, fam(poi) nolog
>>
>> Generalized linear models                          No. of obs      =        16
>> Optimization     : ML                              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]
>>
>>                                                   AIC             =  10.79847
>> Log likelihood   = -79.38776817                    BIC             =  93.00356
>>
>> ------------------------------------------------------------------------------
>>             |                 OIM
>>       count |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
>> -------------+----------------------------------------------------------
>> -------------+------
>>          px |
>>          2  |  -4.07e-08   .2773501    -0.00   1.000    -.5435962    .5435962
>>          3  |   .3794896   .2545139     1.49   0.136    -.1193485    .8783277
>>          4  |   .0741079   .2723524     0.27   0.786    -.4596929    .6079088
>>             |
>>          py |
>>          2  |  -.8109302   .3469443    -2.34   0.019    -1.490929   -.1309318
>>          3  |   .9382696   .2270017     4.13   0.000     .4933544    1.383185
>>          4  |  -.9932518   .3701851    -2.68   0.007    -1.718801   -.2677022
>>             |
>>       _cons |   1.783249   .2588899     6.89   0.000     1.275834    2.290664
>> ------------------------------------------------------------------------------
>>
>> However when I attempt the quasi-symmetric model I get very large and equal standard errors which do not make sense to me:
>>
>> . glm count i.px i.py i.qasym, fam(poi) nolog
>> note: 7.qasym omitted because of collinearity
>> note: 9.qasym omitted because of collinearity
>> note: 10.qasym omitted because of collinearity
>>
>> Generalized linear models                          No. of obs      =        16
>> Optimization     : ML                                  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]
>>
>>                                                                 AIC
>>          =  4.237311
>> Log likelihood   = -20.89849023                    BIC             = -7.339462
>>
>> ------------------------------------------------------------------------------
>>             |                 OIM
>>       count |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
>> -------------+----------------------------------------------------------
>> -------------+------
>>          px |
>>          2  |  -10.64727   1131.109    -0.01   0.992     -2227.58    2206.286
>>          3  |  -9.987129   1131.109    -0.01   0.993     -2226.92    2206.945
>>          4  |   8.229144   1131.109     0.01   0.994    -2208.703    2225.161
>>             |
>>          py |
>>          2  |  -11.32026   1131.109    -0.01   0.992    -2228.253    2205.613
>>          3  |  -8.486948   1131.109    -0.01   0.994    -2225.419    2208.445
>>          4  |  -9.017585   1131.109    -0.01   0.994     -2225.95    2207.915
>>             |
>>       qasym |
>>          2  |   9.089909   1131.109     0.01   0.994    -2207.843    2226.023
>>          3  |   5.887591   1131.109     0.01   0.996    -2211.045     2222.82
>>          4  |  -27.11437   2775.396    -0.01   0.992    -5466.791    5412.562
>>          5  |   20.82242   2262.218     0.01   0.993    -4413.043    4454.688
>>          6  |   18.70797   2262.217     0.01   0.993    -4415.157    4452.573
>>          7  |          0  (omitted)
>>          8  |   18.96654   2262.217     0.01   0.993    -4414.898    4452.831
>>          9  |          0  (omitted)
>>         10  |          0  (omitted)
>>             |
>>       _cons |   3.091024   .2132027    14.50   0.000     2.673155    3.508894
>> ------------------------------------------------------------------------------
>>
>> I would be grateful for any advice on what I am doing wrong. I am using Stata 12.
>>
>> Thank you,
>> Martyn
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>>
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>>
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```