Re: [R] Kolmogorov-Smirnov test and the plot of max distance between two ecdf curves

2012-10-05 Thread user1234
Rui, Your response nearly answered a similar question of mine except that I also have ecdfs of different lengths. Do you know how I can adjust x - seq(min(loga, logb), max(loga, logb), length.out=length(loga)) to account for this? It must be in length.out() but I'm unsure how to proceed.

Re: [R] Kolmogorov-Smirnov test and the plot of max distance between two ecdf curves

2012-10-05 Thread Rui Barradas
Hello, Try length.out = max(length(loga), length(logb)) Note also that all of the previous code and the line above assumes that we are interested in the max distance, whereas the KS statistic computes the supremum of the distance. If it's a two sample test then their values are almost surely

Re: [R] Kolmogorov-Smirnov test and the plot of max distance between two ecdf curves

2012-10-05 Thread Brian S Cade
Subject: Re: [R] Kolmogorov-Smirnov test and the plot of max distance between two ecdf curves Sent by: r-help-boun...@r-project.org Rui, Your response nearly answered a similar question of mine except that I also have ecdfs of different lengths. Do you know how I can adjust x - seq(min

Re: [R] Kolmogorov-Smirnov test and the plot of max distance between two ecdf curves

2012-05-28 Thread maxbre
thanks rui that's what I was looking for I have another related question: - why of the difference between the max distance D calculated with ks.test() and the max distance D “manually” calculated as in (2)? I guess it has something to do with the fact that KS is obtained with a maximisation

Re: [R] Kolmogorov-Smirnov test and the plot of max distance between two ecdf curves

2012-05-28 Thread Rui Barradas
Hello, That's a very difficult question. See Marsaglia, Tsang, Wang (2003) http://www.jstatsoft.org/v08/i18/ Simard, L'Ecuyer (2011) http://www.jstatsoft.org/v39/i11 R's ks functions are a port of Marsaglia et al. to the .C interface. Rui Barradas maxbre wrote thanks rui that's what I

Re: [R] Kolmogorov-Smirnov test and the plot of max distance between two ecdf curves

2012-05-28 Thread maxbre
thanks for the help: I'll have a look at the papers max Il 28/05/2012 12:31, Rui Barradas [via R] ha scritto: Hello, That's a very difficult question. See Marsaglia, Tsang, Wang (2003) http://www.jstatsoft.org/v08/i18/ Simard, L'Ecuyer (2011) http://www.jstatsoft.org/v39/i11 R's ks

Re: [R] Kolmogorov-Smirnov test and the plot of max distance between two ecdf curves

2012-05-28 Thread Rui Barradas
Just a final correction. I was wrong, stats::ks.test doesn't use only Marsaglia et al. It's even clearly written in the help page. Read the documentation before stating! Rui Barradas Em 28-05-2012 11:51, maxbre escreveu: thanks for the help: I'll have a look at the papers max Il 28/05/2012

Re: [R] Kolmogorov-Smirnov test and the plot of max distance between two ecdf curves

2012-05-26 Thread Rui Barradas
Hello, Try the following. (i've changed the color of the first ecdf.) loga - log10(a+1) # do this logb - log10(b+1) # only once f.a - ecdf(loga) f.b - ecdf(logb) # (2) max distance D x - seq(min(loga, logb), max(loga, logb), length.out=length(loga)) x0 - x[which( abs(f.a(x) - f.b(x)) ==

[R] Kolmogorov-Smirnov test and the plot of max distance between two ecdf curves

2012-05-26 Thread maxbre
Hi all, given this example #start a-c(0,70,50,100,70,650,1300,6900,1780,4930,1120,700,190,940, 760,100,300,36270,5610,249680,1760,4040,164890,17230,75140,1870,22380,5890,2430) length(a) b-c(0,0,10,30,50,440,1000,140,70,90,60,60,20,90,180,30,90,