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

From |
<hk489@nyu.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: stumped with lincom after svymean |

Date |
Tue, 31 Aug 2004 17:04:54 -0400 |

Hi Jeff and other Listers - How about the question 2 of Robert? Below is the question: >2 - Is it possible to estimate a one-way anova to detect group differences > with svy commands in Stata 8 based on my above example? In Robert's example, variable x has three categories: 0, 1, and 2. Is there any way to compare the three group differences concurrently (like a one-way anova) with svy commands? Hong ----- Original Message ----- From: jpitblado@stata.com (Jeff Pitblado, StataCorp LP) Date: Tuesday, August 31, 2004 12:16 pm Subject: Re: st: stumped with lincom after svymean > "Robert Bozick" <robertbozick@hotmail.com> asks about using -test- > after-svymean, by()-: > > > Here is what I am trying to accomplish. I have a continuous > variable y, and > > a categorical variable x. The categorical variable x has three > categories: > > 0, 1, and 2. I want to test whether y is different among the > categories of > > my variable x. My data are collected using a stratfied, cluster > design and > > therefore I must use the survey commands. > > > > In previous versions of stata, I would use the code: > > > > svymean y, by(x) > > svytest [x]0=[x]1 > > > > Stata 8 says that svytest no longer exists and that I should use > the lincom > > command. Maybe the coffee hasn't set in, but I cannot figure > out how to do > > replicate the above code using the lincom command based on the > information > > from Stata's help screen. > > > > So my question is two-fold: > > 1 - How do I test group differences using the svy command in > Stata 8 based > > on my above example? > > 2 - Is it possible to estimate a one-way anova to detect group > differences > > with svy commands in Stata 8 based on my above example? > > Here is an example using the auto data (not that I remove the > labels so that > my example appears closer the one above): > > . sysuse auto, clear > . label drop _all > . svyset, srs > . svymean mpg, by(foreign) > . test [mpg]0 = [mpg]1 > > When the -by()- option is supplied to -svymean-, the name of the > variable that > we are taking the mean of becomes something like an equation > identifier when > used with -test-. The values of the categories in the -by()- > variable are > used to identify which mean we are talking about. > > Here is the output from the above example: > > ***** BEGIN: > . sysuse auto, clear > (1978 Automobile Data) > > > . label drop _all > > > . svyset, srs > simple random sample (SRS) > > > . svymean mpg, by(foreign) > > > Survey mean estimation > > > pweight: <none> Number of obs > = 74 > Strata: <one> Number of strata > = 1 > PSU: <observations> Number of PSUs > = 74 > Population size > = 74 > > > ------------------------------------------------------------------- > ----------- > Mean Subpop. | Estimate Std. Err. [95% Conf. Interval] > Deff > ---------------+--------------------------------------------------- > ----------- > mpg | > foreign==0 | 19.82692 .6558681 18.51978 21.13407 > 1 > foreign==1 | 24.77273 1.386503 22.00943 27.53602 > 1 > ------------------------------------------------------------------- > ----------- > > > . test [mpg]0 = [mpg]1 > > > Adjusted Wald test > > > ( 1) [mpg]0 - [mpg]1 = 0 > > > F( 1, 73) = 10.40 > Prob > F = 0.0019 > ***** END: > > --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/ > * * 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: enhanced do-file editor** - Next by Date:
**st: censored model with sample selection** - Previous by thread:
**Re: st: stumped with lincom after svymean** - Next by thread:
**Re: st: stumped with lincom after svymean** - Index(es):

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