Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Equivalent to kruskal-wallis in clustered data


From   "Roger B. Newson" <r.newson@imperial.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Equivalent to kruskal-wallis in clustered data
Date   Thu, 08 Nov 2012 13:37:49 +0000

Thanks for the appreciation. Don't forget to add the -cluster()- option to your -somersd- command, and not make the mistake I made (corrected in my second email in this thread)!

Best wishes

Roger

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: r.newson@imperial.ac.uk
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 08/11/2012 13:26, alfonsa leiva wrote:
Thanks Roger, very usefull

--- On Thu, 11/8/12, Roger B. Newson <r.newson@imperial.ac.uk> wrote:

From: Roger B. Newson <r.newson@imperial.ac.uk>
Subject: Re: st: Equivalent to kruskal-wallis in clustered data
To: statalist@hsphsun2.harvard.edu
Date: Thursday, November 8, 2012, 1:06 PM
Sorry, I made a very stupid mistake
in my last email. The -somersd-
command should of course have been:

xi, noomit: somersd price i.rep78, transf(z) tdist
cluster(firm)

so that the Somers' D parameters are estimated clustered by
-firm-. We
then type, as before:

testparm _I*

to do the F-test of the hypothesis that all Somers' D
parameters are
zero. The correct P-value is then 0.5973.

I hope this helps. Sorry for the confusing mistake.

Best wishes

Roger

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: r.newson@imperial.ac.uk
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 08/11/2012 12:00, Roger B. Newson wrote:
Yes, there is a clustered version of the Kruskal-Wallis
test. It can be
done using the -somersd- package (downloadable from
SSC) with -xi:- and
-testparm-.

For instance, in the -auto- data, we might test
independence of price
and repair record, assuming that we are sampling car
firms from a
population of car firms, instead of sampling car models
from a
population of car models. We set up the data by
typing:

sysuse auto, clear
gene firm=word(make,1)
tab firm, m

This creates and tabulates  a new variable -firm-,
indicating the firm
that makes each car model. We then do the analysis by
typing:

xi, noomit: somersd price i.rep78, transf(z) tdist

which creates variables _Irep78_1 to _Irep78_5,
indicating membership of
each of the 5 repair record groups, and calculates a
Somers' D of each
of these indicators with respect to -price-, with
confidence limits and
a P-value. These Somers' D parameters measure the
association of each
repair record group (compared to all other repair
record groups) with
the car's price in dollars.

To do the test, we then type:

testparm _I*

which tests the hypothesis that all 5 of these Somers'
D parameters are
zero, which implies that no repair group tends to be
more or less
expensive than the rest (the hypothesis usually tested
using a
Kruskall-Wallis test). We see that the P-value is
0.5618, so the null
hypothesis has not been decisively refuted.

I hope this helps. Let me know if you have any further
queries.

Best wishes

Roger


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: r.newson@imperial.ac.uk
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 08/11/2012 10:11, alfonsa leiva wrote:
Dear fellows


Basically, GPs were randomized to 3 groups, in the
bivariate analysis
of effectiveness dependent variable are continuos
and independet
variable are groups 1,2 or 3 . There is any test
equivalent to
kruskall-wallis implemented in stata to test the
study hypothesis
adjusted for the lack of independency of the
patients(clustered data
by GPs)?

Thanks in advance



Alfonso Leiva
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index