Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: comparison of means


From   Roger Newson <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: comparison of means
Date   Tue, 12 Apr 2011 20:37:01 +0100

Yes, this can be done, using the -parmby- and -metaparm- modules of the package -parmest-, which you can download from SSC. This method can do an unequal-variance t-test on weighted or unweighted data.

For instance, if you have a Stata dataset with a variable -group-, equal to 1 for observations in Group 1 and 2 for observations in Group 2, and a sampling-probability weight variable -spweight-, and an outcome variable -y-, then you can use the code

parmby "regress y [pweight=spweight]", by(group) norestore list(,)
metaparm [iweight=(group==1)-(group==2)], list(,)

The first command will overwrite the dataset in memory with a new dataset, with 1 observation per group and data on the 2 weighted group means and their confidence limits, and list this dataset. The second command will create and list a temporary new dataset, with 1 observation, containing the difference between the 2 weighted means, with its confidence limits and its P-value, calculated using Satterthwaite's unequal-variance t-test formula.

For more about -parmest-, you might like to refer to Newson (2008), which gives an example of unequal-variance t-tests using unweighted data.

I hope this helps.

Best wishes

Roger


Reference

Newson, RB. parmest and extensions. Presented at the 14th UK Stata User Meeting, 8-9 September, 2008. Download presentation from
http://www.imperial.ac.uk/nhli/r.newson/usergp.htm#uk2008


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/

Opinions expressed are those of the author, not of the institution.

On 12/04/2011 20:09, Abelev, Melissa wrote:
Hi -

I'm trying to do some simple descriptive statistics.  I want to do a
two-group comparison of means.  The trick is that the data are weighted,
and stata's "classical tests of hypotheses" doesn't allow me to do it.
I found a journal article on a relatively complex calculation to do it
by hand.  I'm hoping stata has a way to do this.  Is there?

- Melissa


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index