The R Project SVN R

Rev

Rev 39080 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 39080 Rev 48518
Line 4... Line 4...
4
## P(sup | F_n - F | > t) < 2 exp(-2nt^2)
4
## P(sup | F_n - F | > t) < 2 exp(-2nt^2)
5
##
5
##
6
## The 2 in front of exp() was derived by Massart. It is the best possible
6
## The 2 in front of exp() was derived by Massart. It is the best possible
7
## constant valid uniformly in t,n,F. For large n*t^2 this agrees with the
7
## constant valid uniformly in t,n,F. For large n*t^2 this agrees with the
8
## large-sample approximation to the Kolmogorov-Smirnov statistic.
8
## large-sample approximation to the Kolmogorov-Smirnov statistic.
9
## 
9
##
10
 
10
 
11
 
11
 
12
superror <- function(rfoo,pfoo,sample.size,...) {
12
superror <- function(rfoo,pfoo,sample.size,...) {
13
    x <- rfoo(sample.size,...)
13
    x <- rfoo(sample.size,...)
14
    tx <- table(x)
14
    tx <- table(signif(x, 12)) # such that xi will be sort(unique(x))
15
    xi <- as.numeric(names(tx))
15
    xi <- as.numeric(names(tx))
16
    f <- pfoo(xi,...)
16
    f <- pfoo(xi,...)
17
    fhat <- cumsum(tx)/sample.size
17
    fhat <- cumsum(tx)/sample.size
18
    max(abs(fhat-f))
18
    max(abs(fhat-f))
19
}
19
}