[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
jpitblado@stata.com (Jeff Pitblado, StataCorp LP) |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: test with sampling weights |

Date |
Tue, 11 Oct 2005 09:56:21 -0500 |

JP Azevedo <jp.statalist@gmail.com> want to use -test- after -svy: tabulate-: > I'm trying to implement a t test with sampling weights using the svy: > tabulate option. > > My understand from the help file is that it is possible to do this by using > the svy postestimation commands. However, I've looked the help and could not > figure out how to use those commands after svy: tabulate oneway. > > I would like to confirm if my understand is correct and would appreciate any > examples. Yes, you can use the -test- command to perform tests of hypotheses between the proportions estimated by -svy: tabulate-. Unfortunately, the column names of the e(b) are not standard, making this difficult. Let's try with one of the NHANES II datasets mentioned in [SVY] manual. . webuse nhanes2b . svy: tabulate sex race (running tabulate on estimation sample) Number of strata = 31 Number of obs = 10351 Number of PSUs = 62 Population size = 1.172e+08 Design df = 31 -------------------------------------- 1=male, | 1=white, 2=black, 3=other 2=female | White Black Other Total ----------+--------------------------- Male | .4225 .0435 .0133 .4794 Female | .4566 .052 .012 .5206 | Total | .8792 .0955 .0253 1 -------------------------------------- Key: cell proportions Pearson: Uncorrected chi2(2) = 4.5159 Design-based F(1.93, 59.72) = 1.2442 P = 0.2946 Suppose we want to test that the population proportion of white males is the same as the population proportion of white females. First, we must find out how to identify these two proportions by looking at the column names in e(b). . mat li e(b) e(b)[1,6] p11 p12 p13 p21 p22 p23 y1 .42254909 .04349737 .01330376 .45660537 .05200855 .01203586 Now we can use these identifiers in our call to -test-. . test _b[p11] = _b[p21] Adjusted Wald test ( 1) p11 - p21 = 0 F( 1, 31) = 14.10 Prob > F = 0.0007 This method can be very cumbersome for large tables. In that case, I would recommend using -svy: mean- with indicator variables that identify the cells you want to compare or -svy: proportion- with a categorical variable. An example of the latter follows: . egen cell = group(sex race), label . svy: proportion cell (running proportion on estimation sample) Survey: Proportion estimation Number of strata = 31 Number of obs = 10351 Number of PSUs = 62 Population size = 1.2e+08 Design df = 31 _prop_1: cell = Male White _prop_2: cell = Male Black _prop_3: cell = Male Other _prop_4: cell = Female White _prop_5: cell = Female Black _prop_6: cell = Female Other -------------------------------------------------------------- | Linearized Binomial Wald | Proportion Std. Err. [95% Conf. Interval] -------------+------------------------------------------------ cell | _prop_1 | .4225491 .008073 .406084 .4390142 _prop_2 | .0434974 .0064771 .0302872 .0567075 _prop_3 | .0133038 .0065997 -.0001564 .026764 _prop_4 | .4566054 .0107333 .4347146 .4784962 _prop_5 | .0520085 .0068534 .038031 .0659861 _prop_6 | .0120359 .004008 .0038614 .0202103 -------------------------------------------------------------- . test _b[_prop_1] = _b[_prop_4] Adjusted Wald test ( 1) [cell]_prop_1 - [cell]_prop_4 = 0 F( 1, 31) = 14.10 Prob > F = 0.0007 --Jeff jpitblado@stata.com * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**Re: st: Getting list of current dataset's variables in order** - Next by Date:
**st: system limit exceeded** - Previous by thread:
**st: test with sampling weights** - Next by thread:
**st: Deciding whether to add a filename extension** - Index(es):

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