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: wilcoxons rank sum in data set with three groups


From   Eric Booth <[email protected]>
To   [email protected]
Subject   Re: st: wilcoxons rank sum in data set with three groups
Date   Tue, 27 Mar 2012 15:32:42 -0500

<>
There's no need to use preserve/restore and to drop if group==3. Instead, just use an [if] condition to limit your test to the groups of interest.  E.g., 

ranksum var1 if group==1 | group==2, by(group)
ranksum var1 if group==1 | group==3, by(group)

or

ranksum var1 if inlist(group, 1,2), by(group)
ranksum var1 if inlist(group, 1,3), by(group)


- Eric


__
Eric A. Booth
Public Policy Research Institute 
Texas A&M University
[email protected]
+979.845.6754

On Mar 27, 2012, at 1:30 PM, Lars Folkestad wrote:

> Dear List
> 
> I have a data set of 10 variables, continuous and 1 grouping variable.
> The grouping variable groups the data into three groups. I want to:
> 
> 1. Test if there is a difference between group 1 and 2
> 2. Test if there is a difference between group 1 and 3
> 3. Its not necessary or interesting for me if there is a difference
> between group 2 and 3.
> 
> I've done the following
> 
> . preserve
> . drop if group == 3
> . ranksum var1, by(group)
> . restore
> 
> Is there a smarter way to do this?
> 
> lars
> 
> 
> *
> *   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