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: Using ksmirnov
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: Using ksmirnov
Date
Wed, 5 Sep 2012 15:57:17 +0100
The first is quite wrong because _only_ a single variable name can be
given as the argument to -by()-.
The second looks exactly right to me, so I don't understand why you
got an error message (presumably what you meant).
. sysuse auto
(1978 Automobile Data)
. ksmirnov mpg if rep78 == 4 | rep78 == 5, by(rep78)
Two-sample Kolmogorov-Smirnov test for equality of distribution functions
Smaller group D P-value Corrected
----------------------------------------------
4: 0.4899 0.038
5: -0.0303 0.988
Combined K-S: 0.4899 0.075 0.041
Note: ties exist in combined dataset;
there are 16 unique values out of 29 observations.
(I still think Kolmogorov-Smirnov usually a waste of time.)
Nick
On Wed, Sep 5, 2012 at 3:41 PM, Morrison Hodges <[email protected]> wrote:
> I'm trying to use ksmirnov to compare 2 distributions to determine if there are any differences in the distribution of the variables.
>
> I have a .dta file with 179 patients. Each patient is classified as being in one of 7 groups from 1 to 7, i.e., group==1, group==2, etc. I want to compare the same variable between 2 groups. All variables are already sorted, from lowest to highest.
>
> 'ksmirnov' requires by(groupvar). I tried:
>
> ksmirnov var, by(group==1, group==3)
>
> and I get an error message that says "invalid variable in by() option.
>
> I tried: ksmirnov jumps if group==1 | group==3, by(group)
> and also got an error method. Can someone help? Thanks, Morry Hodges
*
* 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/