Stata uses Rao-Scott corrections for the scale and degrees of freedom
of the independence test chi^2. It might have happened that something
went negative because of this corrections. For instance, in your
extended case, you lost 1.02 degrees of freedom to the design (compare
chi2(9) and F(7.98, something) ).
On Thu, Oct 1, 2009 at 8:19 AM, Mihir <[email protected]> wrote:
> Dear all:
>
> Anybody has any idea what can be done in the case below?
>
> Thanking you,
> Mihir
>
> On Wed, Sep 30, 2009 at 1:29 AM, Mihir <[email protected]> wrote:
>>
>> Dear all:
>>
>> I am stuck with a problem in pearson chi-square test with survey
>> command. I have setup survey setting for Nationwide Inpatient Survey
>> (NIS) data. I used hospital id as sampling unit, discwt as sampling
>> weight and stratum variable as strata as suggested on NIS website.
>> When I am trying to run chi-square test for independence between age
>> category and year of data collection from 1998 to 2007, it gives
>> proper result, but when I run the same command by retaining only two
>> years (1998 and 2007), it does not produce p-value. I don't understand
>> why it is happening? Can anybody help me - what I should do? I am also
>> getting similar results with other variables that same command works
>> with more year but doesn't work with two years.
>>
>> I have pasted my output for your ready reference.
>>
>> Thanking you in advance,
>> Mihir
>>
>> svyset hospid [pweight=discwt], strata(stratum) vce(linearized)
>>
>> pweight: discwt
>> VCE: linearized
>> Strata 1: stratum
>> SU 1: hospid
>> FPC 1: <zero>
>>
>> svy: tabulate year age2cat, count column row obs percent format(%10.0g) pearson
>> (running tabulate on estimation sample)
>>
>> Number of strata = 60 Number of obs = 157222
>> Number of PSUs = 3270 Population size = 759816.12
>> Design df = 3210
>>
>> -------------------------------------------
>> | age2cat
>> YEAR | <65 year >=65 yea Total
>> ----------+--------------------------------
>> 1998 | 27548.394 10497.654 38046.048
>> | 72.408029 27.591971 100
>> | 4.9658285 5.1193873 5.0072705
>> | 5452 2102 7554
>> |
>> 1999 | 25591.467 9586.1825 35177.649
>> | 72.749224 27.250776 100
>> | 4.613076 4.6748901 4.6297582
>> | 5265 1991 7256
>> |
>> 2000 | 25067.72 9839.9109 34907.631
>> | 71.811576 28.188424 100
>> | 4.5186663 4.7986258 4.5942209
>> | 5163 2032 7195
>> |
>> 2001 | 24673.646 9882.7968 34556.443
>> | 71.401001 28.598999 100
>> | 4.4476311 4.8195399 4.5480007
>> | 4983 1976 6959
>> |
>> 2002 | 83751.067 30869.413 114620.48
>> | 73.068152 26.931848 100
>> | 15.096831 15.054075 15.085292
>> | 17682 6513 24195
>> |
>> 2003 | 80686.437 27375.013 108061.45
>> | 74.66718 25.33282 100
>> | 14.544405 13.349963 14.222053
>> | 17002 5737 22739
>> |
>> 2004 | 77406.999 26898.738 104305.74
>> | 74.211641 25.788359 100
>> | 13.953259 13.117698 13.72776
>> | 16052 5540 21592
>> |
>> 2005 | 74552.231 27032.143 101584.37
>> | 73.389467 26.610533 100
>> | 13.438663 13.182755 13.3696
>> | 15263 5507 20770
>> |
>> 2006 | 68720.522 26875.807 95596.329
>> | 71.886152 28.113848 100
>> | 12.387449 13.106515 12.581508
>> | 14234 5538 19772
>> |
>> 2007 | 66760.785 26199.193 92959.979
>> | 71.816696 28.183304 100
>> | 12.03419 12.776551 12.234536
>> | 13813 5377 19190
>> |
>> Total | 554759.27 205056.85 759816.12
>> | 73.012306 26.987694 100
>> | 100 100 100
>> | 114909 42313 157222
>> -------------------------------------------
>> Key: weighted counts
>> row percentages
>> column percentages
>> number of observations
>>
>> Pearson:
>> Uncorrected chi2(9) = 91.4953
>> Design-based F(7.98, 25611.84)= 3.0966 P = 0.0017
>>
>> keep if year==1998|year==2007
>>
>> svy: tabulate year age2cat, count column row obs percent format(%10.0g) pearson
>> (running tabulate on estimation sample)
>>
>> Number of strata = 60 Number of obs = 26744
>> Number of PSUs = 1205 Population size = 131006.03
>> Design df = 1145
>>
>> -------------------------------------------
>> | age2cat
>> YEAR | <65 year >=65 yea Total
>> ----------+--------------------------------
>> 1998 | 27548.394 10497.654 38046.048
>> | 72.408029 27.591971 100
>> | 29.210724 28.60642 29.041449
>> | 5452 2102 7554
>> |
>> 2007 | 66760.785 26199.193 92959.979
>> | 71.816696 28.183304 100
>> | 70.789276 71.39358 70.958551
>> | 13813 5377 19190
>> |
>> Total | 94309.179 36696.848 131006.03
>> | 71.988428 28.011572 100
>> | 100 100 100
>> | 19265 7479 26744
>> -------------------------------------------
>> Key: weighted counts
>> row percentages
>> column percentages
>> number of observations
>>
>>
>> Pearson:
>> Uncorrected chi2(1) = 0.9557
>> Design-based F(., .) = . P = .
>>
>> *
>> * 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/
>
--
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
* 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/