Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: testing equality of proportions?


From   Dan Waldo <[email protected]>
To   [email protected]
Subject   Re: st: testing equality of proportions?
Date   Tue, 06 Jan 2009 11:15:55 -0500

Maarten has provided the key to this problem by pointing out the need to look at the _b matrix. Each proportion in the tab output is identified by row and column, so to test the significance of the difference in two proportions one would type (say),
.svy: tab AGSY LTC , row ci stubwidth(15)

and then figure out which rows/columns held the proportions to be tested. This can be done by eyeballing the _b matrix after
. matrix list e(b)

or by counting the rows themselves. Then the test takes the form of, e.g.,
. test _b[p1312]=_b[p1302]

which tests row 131 column 2 against row 130 column 2.

Thanks, Maarten!

Dan Waldo wrote:
Thanks to Maarten and Svend for helpful suggestions.Each can be implemented with some modification to my code ... which I don't mind making but which aggravates me.

My data cover hospital emergency department encounters and were collected in 2004, 2005, and 2006. The population is partitioned by age, gender, expected source of payment, and whether the patient came from a long-term care (LTC) facility. My issue is the LTC proportion -- does it vary from year to year and, if so, differently by age/sex/source?

I created a variable that combines age, gender, source of payment, and survey year (AGSY); the LTC residence is binary. Thus I could run

xi: svy: tab AGSY LTC , row ci
-----------------------------------------------
| LTC __000004 | 0 1
-------------+---------------------------------
  ...
A65G2S2Y2004 |           .8302            .1698
            |   [.7997,.8569]    [.1431,.2003]
            |
A65G2S2Y2005 |           .7256            .2744
            |   [.6003,.8231]    [.1769,.3997]
            |
A65G2S2Y2006 |           .7916            .2084
            |    [.6961,.863]     [.137,.3039]
  ...

My hope was to be able to generate a series of tests of the row proportions, e.g., whether the .1698 were different from .2744 and .2084

Svend's suggestion is to look at the Pearson. This works, but only if I run the tab command repeatedly for subsets of the data -- I know that LTC proportions vary across age and gender. So I would have to do something like this:

. svy: tab agsy n if ags=="A65G2S2" , row ci pearson stubwidth(15)
 Pearson:
   Uncorrected   chi2(2)         =    8.9377
   Design-based  F(1.98, 442.07) =    2.2966     P = 0.1023

.

Maarten's suggestion is to follow this model:

*--------------- begin example --------------------
sysuse auto, clear
gen good = rep78 >3 if rep78 < .

proportion good, over(foreign)
test [_prop_1]_b[Foreign] =  [_prop_2]_b[Foreign]
*----------------- end example --------------------

To do so, I have to create a numeric partition variable -- not difficult. Some of the confidence intervals include values over 1 -- not surprising, since in many partitions very few people live in LTC. But my statistical tests turn out empty:

. test [_prop_2]_b[65226] =  [_prop_2]_b[65225]

( 1) - [_prop_2]65225 + [_prop_2]65226 = 0

      F(  1, 14661) =       .
           Prob > F =         .

So either my syntax is still incorrect, or I need another approach. I was thinking of performing a logistic regression of LTC on AGSY and then testing specific coefficients, but I would prefer to use the tabular approach as it is more likely to appeal to my audience.

I wouldn't even mind using table e.g.,
table ags , c(mean ltc04 mean ltc05 mean ltc06)

Unfortunately, table is not supported in svy ... and I still don;t know how to craft the test!
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index