crosstabs > likelihood ratio chi-square > zero-cells

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

crosstabs > likelihood ratio chi-square > zero-cells

Ruben P. Konig
Dear all,

I am wondering what the algorithm is that SPSS uses to calculate the
likelihood ratio chi-square in its procedure crosstabs. The
support-pages of spss contain the formula that is allegedly used by
crosstabs, but that formula cannot calculate the likelihood ratio
chi-square if there are zero-cells (division by zero). However, if I ask
spss for the chi-square statistics of a cross-table with one or more
zero-cells, it does give me a value for the likelihood ratio chi-square
(with as many degrees of freedom as Pearson's chi-square). Is my
reasoning unsound, or is the algorithm on spss' website incomplete?

Kind regards,
Ruben

--
Dr. Ruben P. Konig
Department of Communication      telephone +31 24 3615789/3612372
Radboud University Nijmegen      telefax +31 24 3613073
P. O. Box 9104
6500 HE  Nijmegen                [hidden email]
The Netherlands                  http://oase.uci.kun.nl/~rkonig

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: crosstabs > likelihood ratio chi-square > zero-cells

Anthony Babinec
Good question. The formula in SPSS algorithms appears to
have the within-cells ratio wrong. The ratio should show observed over
Expected -- f/E

Anthony Babinec
[hidden email]

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Ruben P. Konig
Sent: Thursday, April 10, 2008 3:21 AM
To: [hidden email]
Subject: crosstabs > likelihood ratio chi-square > zero-cells

Dear all,

I am wondering what the algorithm is that SPSS uses to calculate the
likelihood ratio chi-square in its procedure crosstabs. The
support-pages of spss contain the formula that is allegedly used by
crosstabs, but that formula cannot calculate the likelihood ratio
chi-square if there are zero-cells (division by zero). However, if I ask
spss for the chi-square statistics of a cross-table with one or more
zero-cells, it does give me a value for the likelihood ratio chi-square
(with as many degrees of freedom as Pearson's chi-square). Is my
reasoning unsound, or is the algorithm on spss' website incomplete?

Kind regards,
Ruben

--
Dr. Ruben P. Konig
Department of Communication      telephone +31 24 3615789/3612372
Radboud University Nijmegen      telefax +31 24 3613073
P. O. Box 9104
6500 HE  Nijmegen                [hidden email]
The Netherlands                  http://oase.uci.kun.nl/~rkonig

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: crosstabs > likelihood ratio chi-square > zero-cells

Art Kendall
Anthony Babinec wrote:

> Good question. The formula in SPSS algorithms appears to
> have the within-cells ratio wrong. The ratio should show observed over
> Expected -- f/E
>
> Anthony Babinec
> [hidden email]
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
> Ruben P. Konig
> Sent: Thursday, April 10, 2008 3:21 AM
> To: [hidden email]
> Subject: crosstabs > likelihood ratio chi-square > zero-cells
>
> Dear all,
>
> I am wondering what the algorithm is that SPSS uses to calculate the
> likelihood ratio chi-square in its procedure crosstabs. The
> support-pages of spss contain the formula that is allegedly used by
> crosstabs, but that formula cannot calculate the likelihood ratio
> chi-square if there are zero-cells (division by zero). However, if I ask
> spss for the chi-square statistics of a cross-table with one or more
> zero-cells, it does give me a value for the likelihood ratio chi-square
> (with as many degrees of freedom as Pearson's chi-square). Is my
> reasoning unsound, or is the algorithm on spss' website incomplete?
>
> Kind regards,
> Ruben
>
> --
> Dr. Ruben P. Konig
> Department of Communication      telephone +31 24 3615789/3612372
> Radboud University Nijmegen      telefax +31 24 3613073
> P. O. Box 9104
> 6500 HE  Nijmegen                [hidden email]
> The Netherlands                  http://oase.uci.kun.nl/~rkonig
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: crosstabs > likelihood ratio chi-square > zero-cells

Ruben P. Konig
In reply to this post by Ruben P. Konig
Dear all,

I have done some "reverse engineering" and think that spss adds a tiny
value to all cells in the table in case of zero-cells. I had a 9x4 table
with 392 observations. Six cells were empty. I added 0.000001 to the
content of all cells and computed the likelihood ratio chi-square using
the matrix procedure. That lead to the same result as crosstabs came up
with. Does this ring a bell? It might be a coincidence, of course. If
anyone out there knows more, I would be most obliged.

Kind regards,
Ruben

Ruben P. Konig wrote:

> Dear all,
>
> I am wondering what the algorithm is that SPSS uses to calculate the
> likelihood ratio chi-square in its procedure crosstabs. The
> support-pages of spss contain the formula that is allegedly used by
> crosstabs, but that formula cannot calculate the likelihood ratio
> chi-square if there are zero-cells (division by zero). However, if I ask
> spss for the chi-square statistics of a cross-table with one or more
> zero-cells, it does give me a value for the likelihood ratio chi-square
> (with as many degrees of freedom as Pearson's chi-square). Is my
> reasoning unsound, or is the algorithm on spss' website incomplete?
>
> Kind regards,
> Ruben
>

--
Dr. Ruben P. Konig
Department of Communication      telephone +31 24 3615789/3612372
Radboud University Nijmegen      telefax +31 24 3613073
P. O. Box 9104
6500 HE  Nijmegen                [hidden email]
The Netherlands                  http://oase.uci.kun.nl/~rkonig

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: crosstabs > likelihood ratio chi-square > zero-cells

Art Kendall
In reply to this post by Anthony Babinec
I don't know how my previous reply only had the quote from the previous
post.
This is extra sentences so that the listserv s/w does not think it is a
re-transmission of exactly the
same post.


It is possible to have a zero raw cell count (numerator, f) and
a non-zero expected cell count (denominator, E).

Try using the option in CROSSTABS to display the expected counts in the
cells.

Art Kendall
Social Research Consultants.



Anthony Babinec wrote:

> Good question. The formula in SPSS algorithms appears to
> have the within-cells ratio wrong. The ratio should show observed over
> Expected -- f/E
>
> Anthony Babinec
> [hidden email]
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
> Ruben P. Konig
> Sent: Thursday, April 10, 2008 3:21 AM
> To: [hidden email]
> Subject: crosstabs > likelihood ratio chi-square > zero-cells
>
> Dear all,
>
> I am wondering what the algorithm is that SPSS uses to calculate the
> likelihood ratio chi-square in its procedure crosstabs. The
> support-pages of spss contain the formula that is allegedly used by
> crosstabs, but that formula cannot calculate the likelihood ratio
> chi-square if there are zero-cells (division by zero). However, if I ask
> spss for the chi-square statistics of a cross-table with one or more
> zero-cells, it does give me a value for the likelihood ratio chi-square
> (with as many degrees of freedom as Pearson's chi-square). Is my
> reasoning unsound, or is the algorithm on spss' website incomplete?
>
> Kind regards,
> Ruben
>
> --
> Dr. Ruben P. Konig
> Department of Communication      telephone +31 24 3615789/3612372
> Radboud University Nijmegen      telefax +31 24 3613073
> P. O. Box 9104
> 6500 HE  Nijmegen                [hidden email]
> The Netherlands                  http://oase.uci.kun.nl/~rkonig
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: crosstabs > likelihood ratio chi-square > zero-cells

Art Kendall
In reply to this post by Ruben P. Konig
Did you find out if you had zero in any cells for Expected?

Art Kendall
Social Research Consultants

Ruben P. Konig wrote:

> Dear all,
>
> I have done some "reverse engineering" and think that spss adds a tiny
> value to all cells in the table in case of zero-cells. I had a 9x4 table
> with 392 observations. Six cells were empty. I added 0.000001 to the
> content of all cells and computed the likelihood ratio chi-square using
> the matrix procedure. That lead to the same result as crosstabs came up
> with. Does this ring a bell? It might be a coincidence, of course. If
> anyone out there knows more, I would be most obliged.
>
> Kind regards,
> Ruben
>
> Ruben P. Konig wrote:
>> Dear all,
>>
>> I am wondering what the algorithm is that SPSS uses to calculate the
>> likelihood ratio chi-square in its procedure crosstabs. The
>> support-pages of spss contain the formula that is allegedly used by
>> crosstabs, but that formula cannot calculate the likelihood ratio
>> chi-square if there are zero-cells (division by zero). However, if I ask
>> spss for the chi-square statistics of a cross-table with one or more
>> zero-cells, it does give me a value for the likelihood ratio chi-square
>> (with as many degrees of freedom as Pearson's chi-square). Is my
>> reasoning unsound, or is the algorithm on spss' website incomplete?
>>
>> Kind regards,
>> Ruben
>>
>
> --
> Dr. Ruben P. Konig
> Department of Communication      telephone +31 24 3615789/3612372
> Radboud University Nijmegen      telefax +31 24 3613073
> P. O. Box 9104
> 6500 HE  Nijmegen                [hidden email]
> The Netherlands                  http://oase.uci.kun.nl/~rkonig
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: crosstabs > likelihood ratio chi-square > zero-cells

Reutter, Alex
In reply to this post by Ruben P. Konig
Hello Ruben,

Nothing is actually added to empty cells behind the scenes.  The formula for the LR chi-square can be written as:

-2 * SUM [N_ij * ln (E_ij/N_ij)]

or

2 * SUM [N_ij * ln (N_ij/E_ij)]

In the first case, you have a divide by 0 in the ratio, and in the second case you have the log of 0. Either one is undefined. However, in each case it is multiplied by 0 (and SPSS treats 0*sysmis as 0; put 0*log(0) into a compute statement and see), so that cell doesn't contribute anything to the sum.

Cheers,
Alex



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Ruben P. Konig
Sent: Thursday, April 10, 2008 10:04 AM
To: [hidden email]
Subject: Re: [SPSSX-L] crosstabs > likelihood ratio chi-square > zero-cells

Dear all,

I have done some "reverse engineering" and think that spss adds a tiny value to all cells in the table in case of zero-cells. I had a 9x4 table with 392 observations. Six cells were empty. I added 0.000001 to the content of all cells and computed the likelihood ratio chi-square using the matrix procedure. That lead to the same result as crosstabs came up with. Does this ring a bell? It might be a coincidence, of course. If anyone out there knows more, I would be most obliged.

Kind regards,
Ruben

Ruben P. Konig wrote:

> Dear all,
>
> I am wondering what the algorithm is that SPSS uses to calculate the
> likelihood ratio chi-square in its procedure crosstabs. The
> support-pages of spss contain the formula that is allegedly used by
> crosstabs, but that formula cannot calculate the likelihood ratio
> chi-square if there are zero-cells (division by zero). However, if I
> ask spss for the chi-square statistics of a cross-table with one or
> more zero-cells, it does give me a value for the likelihood ratio
> chi-square (with as many degrees of freedom as Pearson's chi-square).
> Is my reasoning unsound, or is the algorithm on spss' website incomplete?
>
> Kind regards,
> Ruben
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: crosstabs > likelihood ratio chi-square > zero-cells

Reutter, Alex
In reply to this post by Ruben P. Konig
Addendum: also note that this is a limiting case where

   lim n->0  n*log(n) = 0

... so in your "reverse engineering" example, if on successive runs you add tinier and tinier values to the original values of all cells, your computations will converge to the exact value that SPSS produces.

Alex


-----Original Message-----
From: Reutter, Alex
Sent: Monday, April 14, 2008 8:55 AM
To: [hidden email]
Subject: Re: [SPSSX-L] crosstabs > likelihood ratio chi-square > zero-cells

Hello Ruben,

Nothing is actually added to empty cells behind the scenes.  The formula for the LR chi-square can be written as:

-2 * SUM [N_ij * ln (E_ij/N_ij)]

or

2 * SUM [N_ij * ln (N_ij/E_ij)]

In the first case, you have a divide by 0 in the ratio, and in the second case you have the log of 0. Either one is undefined. However, in each case it is multiplied by 0 (and SPSS treats 0*sysmis as 0; put 0*log(0) into a compute statement and see), so that cell doesn't contribute anything to the sum.

Cheers,
Alex



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Ruben P. Konig
Sent: Thursday, April 10, 2008 10:04 AM
To: [hidden email]
Subject: Re: [SPSSX-L] crosstabs > likelihood ratio chi-square > zero-cells

Dear all,

I have done some "reverse engineering" and think that spss adds a tiny value to all cells in the table in case of zero-cells. I had a 9x4 table with 392 observations. Six cells were empty. I added 0.000001 to the content of all cells and computed the likelihood ratio chi-square using the matrix procedure. That lead to the same result as crosstabs came up with. Does this ring a bell? It might be a coincidence, of course. If anyone out there knows more, I would be most obliged.

Kind regards,
Ruben

Ruben P. Konig wrote:

> Dear all,
>
> I am wondering what the algorithm is that SPSS uses to calculate the
> likelihood ratio chi-square in its procedure crosstabs. The
> support-pages of spss contain the formula that is allegedly used by
> crosstabs, but that formula cannot calculate the likelihood ratio
> chi-square if there are zero-cells (division by zero). However, if I
> ask spss for the chi-square statistics of a cross-table with one or
> more zero-cells, it does give me a value for the likelihood ratio
> chi-square (with as many degrees of freedom as Pearson's chi-square).
> Is my reasoning unsound, or is the algorithm on spss' website incomplete?
>
> Kind regards,
> Ruben
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD