Hello r-group I have a question to the ks.test. I would expect different values for less and greater between data1 and data2. Does anybody could explain my point of misunderstanding the function? data1<-c(8,12,43,70) data2<- c(70,43,12,8) ks.test(data1,"pnorm") ks.test(data1,"pnorm",alternative ="less") #expected < 0.001 ks.test(data1,"pnorm",alternative ="greater") #expected =1 ks.test(data2,"pnorm") ks.test(data2,"pnorm",alternative ="less") #expected =1 ks.test(data2,"pnorm",alternative ="greater") #expected < 0.001 With regards Carmen
ks.test "greater" and "less"
4 messages · Carmen Meier, R. Villegas, Brian Ripley
2006/12/15, Carmen Meier <carmei3 at web.de>:
Hello r-group I have a question to the ks.test. I would expect different values for less and greater between data1 and data2. Does anybody could explain my point of misunderstanding the function? data1<-c(8,12,43,70) data2<- c(70,43,12,8) ks.test(data1,"pnorm") ks.test(data1,"pnorm",alternative ="less") #expected < 0.001 ks.test(data1,"pnorm",alternative ="greater") #expected =1 ks.test(data2,"pnorm") ks.test(data2,"pnorm",alternative ="less") #expected =1 ks.test(data2,"pnorm",alternative ="greater") #expected < 0.001 With regards Carmen
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Possible you are unable to use the Kolmogorov?Smirnov test given that the sample size is small.
On Sat, 16 Dec 2006, R. Villegas wrote:
2006/12/15, Carmen Meier <carmei3 at web.de>:
Hello r-group I have a question to the ks.test. I would expect different values for less and greater between data1 and data2. Does anybody could explain my point of misunderstanding the function?
The help page says:
This is a comparison of cumulative distribution
functions, and the test statistic is the maximum difference in
value, with the statistic in the '"greater"' alternative being D^+
= max_u [ F_x(u) - F_y(u) ].
data1 and data2 have the same empirical CDF, so should and do give the
same value of the test statistic.
We cannot know what you misunderstanding is, since you have not explained
your expectations.
data1<-c(8,12,43,70) data2<- c(70,43,12,8) ks.test(data1,"pnorm") ks.test(data1,"pnorm",alternative ="less") #expected < 0.001 ks.test(data1,"pnorm",alternative ="greater") #expected =1 ks.test(data2,"pnorm") ks.test(data2,"pnorm",alternative ="less") #expected =1 ks.test(data2,"pnorm",alternative ="greater") #expected < 0.001 With regards Carmen
Possible you are unable to use the Kolmogorov??Smirnov test given that the sample size is small.
You can: the distribution theory is exact.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Prof Brian Ripley schrieb:
On Sat, 16 Dec 2006, R. Villegas wrote:
2006/12/15, Carmen Meier <carmei3 at web.de>:
Hello r-group I have a question to the ks.test. I would expect different values for less and greater between data1 and data2. Does anybody could explain my point of misunderstanding the function?
The help page says:
This is a comparison of cumulative distribution
functions, and the test statistic is the maximum difference in
value, with the statistic in the '"greater"' alternative being D^+
= max_u [ F_x(u) - F_y(u) ].
data1 and data2 have the same empirical CDF, so should and do give the
same value of the test statistic.
We cannot know what you misunderstanding is, since you have not
explained your expectations.
Thank you for your answers, seems that I was abusing the R-Group for statistical question which should be posted in f.e. sci.stat.edu. .. the misunderstanding was, that I thought ks.test is different between sort order decreasing and increasing. With regards Carmen