difference between chi squares

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

difference between chi squares

Howard Schuman
This is at least partly a statistical question but also concerns SPSS.

I am comparing the distributions for each of two independent samples (A
and B) with the distribution produced by a third sample (C, from an
earlier point in time). Since the variable involved has eight unordered
categories, I've calculated two chi squares: one between A and C and one
between B and C. Both are highly significant, but the second is
noticeably larger than the first.

The question is how to test the difference formally between the two chi
squares. (The problem for me is that one of the variables is the same in
both the AC and BC tests, so this seems not the same as, say, an
ordinary test of interaction.)

        Thanks for any advice that may be offered,  hs

=====================
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: difference between chi squares

Burleson,Joseph A.
Howard:

There are references describing how to take the difference between the 2 chi-squares, distributed as chi-square also (e.g., Terry C. Blum, Stuart H. Milne, Chester S. Spell. (1996). Workplace characteristics and health care cost containment practices. Journal of Management. "This technique is based on the fact that a difference between two Chi-squares is also distributed as a Chi-square with degrees of freedom equal to the difference in degrees of freedom for the two models.").

I am unclear how you could have compared "two samples," A and B. Do you mean two variables? I am envisioning that two variables from a given sample could be assessed with chi-square for their association. But you are labeling the 3 samples as A, B, and C.

Joe Burleson

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of howard schuman
Sent: Wednesday, December 22, 2010 2:05 PM
To: [hidden email]
Subject: difference between chi squares

This is at least partly a statistical question but also concerns SPSS.

I am comparing the distributions for each of two independent samples (A
and B) with the distribution produced by a third sample (C, from an
earlier point in time). Since the variable involved has eight unordered
categories, I've calculated two chi squares: one between A and C and one
between B and C. Both are highly significant, but the second is
noticeably larger than the first.

The question is how to test the difference formally between the two chi
squares. (The problem for me is that one of the variables is the same in
both the AC and BC tests, so this seems not the same as, say, an
ordinary test of interaction.)

        Thanks for any advice that may be offered,  hs

=====================
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: difference between chi squares

Bruce Weaver
Administrator
In reply to this post by Howard Schuman
Howard Schuman wrote
This is at least partly a statistical question but also concerns SPSS.

I am comparing the distributions for each of two independent samples (A
and B) with the distribution produced by a third sample (C, from an
earlier point in time). Since the variable involved has eight unordered
categories, I've calculated two chi squares: one between A and C and one
between B and C. Both are highly significant, but the second is
noticeably larger than the first.

The question is how to test the difference formally between the two chi
squares. (The problem for me is that one of the variables is the same in
both the AC and BC tests, so this seems not the same as, say, an
ordinary test of interaction.)

        Thanks for any advice that may be offered,  hs

Hi Howard.  When you say A and B represent two independent samples, I envision a single variable with a value of either A or B on each row.  But then you appear to be crosstabulating A with B and A with C, which suggest that A and B are variables, not values of a Group variable.  So in short, I am confused!  Can you provide a small sample of what your data file looks like?

Cheers,
Bruce
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: difference between chi squares

Bruce Weaver
Administrator
Bruce Weaver wrote
Howard Schuman wrote
This is at least partly a statistical question but also concerns SPSS.

I am comparing the distributions for each of two independent samples (A
and B) with the distribution produced by a third sample (C, from an
earlier point in time). Since the variable involved has eight unordered
categories, I've calculated two chi squares: one between A and C and one
between B and C. Both are highly significant, but the second is
noticeably larger than the first.

The question is how to test the difference formally between the two chi
squares. (The problem for me is that one of the variables is the same in
both the AC and BC tests, so this seems not the same as, say, an
ordinary test of interaction.)

        Thanks for any advice that may be offered,  hs

Hi Howard.  When you say A and B represent two independent samples, I envision a single variable with a value of either A or B on each row.  But then you appear to be crosstabulating A with B and A with C, which suggest that A and B are variables, not values of a Group variable.  So in short, I am confused!  Can you provide a small sample of what your data file looks like?

Cheers,
Bruce
Howard and I have had some off-list discussion, and I think the following generates the chi-square tests he is talking about.  Notice that due to rounding, the total N for column A ends up being off by 4 (1624 instead of 1628).  But given the magnitude of the chi-square values, I don't think it matters much.


new file.
dataset close all.

data list list / row col percent (2f2.0 f5.2).
begin data
1 1 37.8
1 2 5.7
1 3 19.4
2 1 5.0
2 2 10.9
2 3 16.1
3 1 5.7
3 2 1.1
3 3 7.7
4 1 2.3
4 2 9.8
4 3 3.2
5 1 7.8
5 2 59.1
5 3 41.2
6 1 5.7
6 2 5.7
6 3 4.5
7 1 2.4
7 2 0.5
7 3 1.9
8 1 33.1
8 2 6.9
8 3 5.8
end data.

value labels col 1 'A' 2 'B' 3 'C'.

do if col EQ 1.
- compute N = 1628.
else if col EQ 2.
- compute N = 174.
else if col EQ 3.
- compute N = 155.
end if.
compute kount = rnd(N*percent/100).
format N kount (f5.0).
list.

weight by kount.

* The two chi-square tests Howard describes.
* A v B.
temp.
select if col NE 3.
crosstabs row by col / stat = chisqr.

* A v C.
temp.
select if col NE 2.
crosstabs row by col / stat = chisqr.

* Howard wants to compare the chi-square values
* from the two tables above.  But as A is involved
* in both, they are not independent of each other.
* So the covariance will be needed, I think.

--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: difference between chi squares

Ryan
I have never been faced with this type of problem before, so take what
I'm about to say with a grain of salt. I think you can reconstruct the
Likelihood Ratio Chi-Square tests [performed in CROSSTABS] via the
NOMREG procedure as follows:

*---------------------.
weight by kount.

temp.
select if col NE 3.

NOMREG row (BASE=LAST ORDER=ASCENDING) BY col
  /MODEL
  /INTERCEPT=INCLUDE
  /PRINT=LRT.

temp.
select if col NE 2.

NOMREG row (BASE=LAST ORDER=ASCENDING) BY col
  /MODEL
  /INTERCEPT=INCLUDE
  /PRINT=LRT.
*---------------------.

This, of course, does not solve the problem. Still, writing out this
code helped me to think about the problem within the multinomial
logistic regression framework. This line of thinking may prove
beneficial in arriving at a solution. Whether or not the solution can
be easily implemented in SPSS is another matter. I'll keep thinking
about this problem and will certainly write back if I make a break
through of some sort.

Ryan

On Wed, Dec 22, 2010 at 5:57 PM, Bruce Weaver <[hidden email]> wrote:

> Bruce Weaver wrote:
>>
>>
>> Howard Schuman wrote:
>>>
>>> This is at least partly a statistical question but also concerns SPSS.
>>>
>>> I am comparing the distributions for each of two independent samples (A
>>> and B) with the distribution produced by a third sample (C, from an
>>> earlier point in time). Since the variable involved has eight unordered
>>> categories, I've calculated two chi squares: one between A and C and one
>>> between B and C. Both are highly significant, but the second is
>>> noticeably larger than the first.
>>>
>>> The question is how to test the difference formally between the two chi
>>> squares. (The problem for me is that one of the variables is the same in
>>> both the AC and BC tests, so this seems not the same as, say, an
>>> ordinary test of interaction.)
>>>
>>>         Thanks for any advice that may be offered,  hs
>>>
>>>
>>
>>
>> Hi Howard.  When you say A and B represent two independent samples, I
>> envision a single variable with a value of either A or B on each row.  But
>> then you appear to be crosstabulating A with B and A with C, which suggest
>> that A and B are variables, not values of a Group variable.  So in short,
>> I am confused!  Can you provide a small sample of what your data file
>> looks like?
>>
>> Cheers,
>> Bruce
>>
>>
>
> Howard and I have had some off-list discussion, and I think the following
> generates the chi-square tests he is talking about.  Notice that due to
> rounding, the total N for column A ends up being off by 4 (1624 instead of
> 1628).  But given the magnitude of the chi-square values, I don't think it
> matters much.
>
>
> new file.
> dataset close all.
>
> data list list / row col percent (2f2.0 f5.2).
> begin data
> 1 1 37.8
> 1 2 5.7
> 1 3 19.4
> 2 1 5.0
> 2 2 10.9
> 2 3 16.1
> 3 1 5.7
> 3 2 1.1
> 3 3 7.7
> 4 1 2.3
> 4 2 9.8
> 4 3 3.2
> 5 1 7.8
> 5 2 59.1
> 5 3 41.2
> 6 1 5.7
> 6 2 5.7
> 6 3 4.5
> 7 1 2.4
> 7 2 0.5
> 7 3 1.9
> 8 1 33.1
> 8 2 6.9
> 8 3 5.8
> end data.
>
> value labels col 1 'A' 2 'B' 3 'C'.
>
> do if col EQ 1.
> - compute N = 1628.
> else if col EQ 2.
> - compute N = 174.
> else if col EQ 3.
> - compute N = 155.
> end if.
> compute kount = rnd(N*percent/100).
> format N kount (f5.0).
> list.
>
> weight by kount.
>
> * The two chi-square tests Howard describes.
> * A v B.
> temp.
> select if col NE 3.
> crosstabs row by col / stat = chisqr.
>
> * A v C.
> temp.
> select if col NE 2.
> crosstabs row by col / stat = chisqr.
>
> * Howard wants to compare the chi-square values
> * from the two tables above.  But as A is involved
> * in both, they are not independent of each other.
> * So the covariance will be needed, I think.
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/difference-between-chi-squares-tp3315520p3315805.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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: difference between chi squares

Ryan
Hi all,

This message is a follow-up response to the main question posed in
this thread several weeks ago.

After reading SPSS documentation, I THINK one could employ the TEST
subcommand in the NOMREG procedure to perform the difference of the
difference contrast "for all of the logits":

(column A - column B) - (column A - column C)

Using the data set created by Bruce's code below, I show how to fit
the model and write the TEST statement. The results from the
difference of the difference contrast to which I'm referring are
located at the end of the output file (Wald = 248.473, df=7, p<.001).
This is not exactly what the OP wanted, but it may be close enough.
I've never used the TEST subcommand for this procedure--It's certainly
possible that my thinking may be off here.

Ryan
--

new file.
dataset close all.

data list list / row col percent (2f2.0 f5.2).
begin data
1 1 37.8
1 2 5.7
1 3 19.4
2 1 5.0
2 2 10.9
2 3 16.1
3 1 5.7
3 2 1.1
3 3 7.7
4 1 2.3
4 2 9.8
4 3 3.2
5 1 7.8
5 2 59.1
5 3 41.2
6 1 5.7
6 2 5.7
6 3 4.5
7 1 2.4
7 2 0.5
7 3 1.9
8 1 33.1
8 2 6.9
8 3 5.8
end data.

value labels col 1 'A' 2 'B' 3 'C'.

do if col EQ 1.
- compute N = 1628.
else if col EQ 2.
- compute N = 174.
else if col EQ 3.
- compute N = 155.
end if.
compute kount = rnd(N*percent/100).
format N kount (f5.0).
list.

weight by kount.

RECODE col (2=1) (ELSE=0) INTO colB_dummyvar.
RECODE col (3=1) (ELSE=0) INTO colC_dummyvar.
EXECUTE.

NOMREG row (BASE=LAST ORDER=ASCENDING) WITH colB_dummyvar colC_dummyvar
 /MODEL
 /INTERCEPT=INCLUDE
 /TEST colB_dummyvar 1 colC_dummyvar -1.

On Wed, Dec 22, 2010 at 11:07 PM, R B <[hidden email]> wrote:

> I have never been faced with this type of problem before, so take what
> I'm about to say with a grain of salt. I think you can reconstruct the
> Likelihood Ratio Chi-Square tests [performed in CROSSTABS] via the
> NOMREG procedure as follows:
>
> *---------------------.
> weight by kount.
>
> temp.
> select if col NE 3.
>
> NOMREG row (BASE=LAST ORDER=ASCENDING) BY col
>  /MODEL
>  /INTERCEPT=INCLUDE
>  /PRINT=LRT.
>
> temp.
> select if col NE 2.
>
> NOMREG row (BASE=LAST ORDER=ASCENDING) BY col
>  /MODEL
>  /INTERCEPT=INCLUDE
>  /PRINT=LRT.
> *---------------------.
>
> This, of course, does not solve the problem. Still, writing out this
> code helped me to think about the problem within the multinomial
> logistic regression framework. This line of thinking may prove
> beneficial in arriving at a solution. Whether or not the solution can
> be easily implemented in SPSS is another matter. I'll keep thinking
> about this problem and will certainly write back if I make a break
> through of some sort.
>
> Ryan
>
> On Wed, Dec 22, 2010 at 5:57 PM, Bruce Weaver <[hidden email]> wrote:
>> Bruce Weaver wrote:
>>>
>>>
>>> Howard Schuman wrote:
>>>>
>>>> This is at least partly a statistical question but also concerns SPSS.
>>>>
>>>> I am comparing the distributions for each of two independent samples (A
>>>> and B) with the distribution produced by a third sample (C, from an
>>>> earlier point in time). Since the variable involved has eight unordered
>>>> categories, I've calculated two chi squares: one between A and C and one
>>>> between B and C. Both are highly significant, but the second is
>>>> noticeably larger than the first.
>>>>
>>>> The question is how to test the difference formally between the two chi
>>>> squares. (The problem for me is that one of the variables is the same in
>>>> both the AC and BC tests, so this seems not the same as, say, an
>>>> ordinary test of interaction.)
>>>>
>>>>         Thanks for any advice that may be offered,  hs
>>>>
>>>>
>>>
>>>
>>> Hi Howard.  When you say A and B represent two independent samples, I
>>> envision a single variable with a value of either A or B on each row.  But
>>> then you appear to be crosstabulating A with B and A with C, which suggest
>>> that A and B are variables, not values of a Group variable.  So in short,
>>> I am confused!  Can you provide a small sample of what your data file
>>> looks like?
>>>
>>> Cheers,
>>> Bruce
>>>
>>>
>>
>> Howard and I have had some off-list discussion, and I think the following
>> generates the chi-square tests he is talking about.  Notice that due to
>> rounding, the total N for column A ends up being off by 4 (1624 instead of
>> 1628).  But given the magnitude of the chi-square values, I don't think it
>> matters much.
>>
>>
>> new file.
>> dataset close all.
>>
>> data list list / row col percent (2f2.0 f5.2).
>> begin data
>> 1 1 37.8
>> 1 2 5.7
>> 1 3 19.4
>> 2 1 5.0
>> 2 2 10.9
>> 2 3 16.1
>> 3 1 5.7
>> 3 2 1.1
>> 3 3 7.7
>> 4 1 2.3
>> 4 2 9.8
>> 4 3 3.2
>> 5 1 7.8
>> 5 2 59.1
>> 5 3 41.2
>> 6 1 5.7
>> 6 2 5.7
>> 6 3 4.5
>> 7 1 2.4
>> 7 2 0.5
>> 7 3 1.9
>> 8 1 33.1
>> 8 2 6.9
>> 8 3 5.8
>> end data.
>>
>> value labels col 1 'A' 2 'B' 3 'C'.
>>
>> do if col EQ 1.
>> - compute N = 1628.
>> else if col EQ 2.
>> - compute N = 174.
>> else if col EQ 3.
>> - compute N = 155.
>> end if.
>> compute kount = rnd(N*percent/100).
>> format N kount (f5.0).
>> list.
>>
>> weight by kount.
>>
>> * The two chi-square tests Howard describes.
>> * A v B.
>> temp.
>> select if col NE 3.
>> crosstabs row by col / stat = chisqr.
>>
>> * A v C.
>> temp.
>> select if col NE 2.
>> crosstabs row by col / stat = chisqr.
>>
>> * Howard wants to compare the chi-square values
>> * from the two tables above.  But as A is involved
>> * in both, they are not independent of each other.
>> * So the covariance will be needed, I think.
>>
>>
>>
>> -----
>> --
>> Bruce Weaver
>> [hidden email]
>> http://sites.google.com/a/lakeheadu.ca/bweaver/
>>
>> "When all else fails, RTFM."
>>
>> NOTE: My Hotmail account is not monitored regularly.
>> To send me an e-mail, please use the address shown above.
>>
>> --
>> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/difference-between-chi-squares-tp3315520p3315805.html
>> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>>
>> =====================
>> 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