In [1]:
x <- c(1, 10, 20, 30, 40, 52, 63, 70, 80, 90, 100, 102, 130, 140, 190, 210, 266, 310, 530, 590, 640, 1340)
n <- length(x)
n
Out[1]:
In [2]:
alpha <- 0.05
epsn <- sqrt(1/(2*n) * log(2/alpha))
In [3]:
Fn <- (1:n)/n
plot(x, Fn, type="s", lwd=1, ylab="", xlab="x", main="95% DKW-Konfidenzband")
lower <- pmax(Fn - epsn, 0)
upper <- pmin(Fn + epsn, 1)
conf.b <- cbind(lower, upper)
matplot(x, conf.b, type="s", col=2, add=TRUE)
In [4]:
dist.exp <- function(DATA) {
n <- length(DATA)
mu <- mean(DATA)
d.s <- sort(DATA)
e.1 <- (1:n)/n
e.2 <- (0:(n-1))/n
Fx <- pexp(d.s,1/mu)
ABS <- c(abs(Fx-e.1),abs(Fx-e.2))
MAX <- max(ABS)
ind <- which.max(ABS)
c(MAX, ind)
}
In [5]:
dist.exp(x)
Out[5]:
Tabelle 4: 0.95 / n=20 -> 0.234 => nicht verwerfen
In [6]:
dist.norm <- function(DATA) {
n <- length(DATA)
mu <- mean(DATA)
sig <- sd(DATA)
d.s <- sort(DATA)
e.1 <- (1:n)/n
e.2 <- (0:(n-1))/n
Fx <- pnorm(d.s,mu,sig)
ABS <- c(abs(Fx-e.1),abs(Fx-e.2))
MAX <- max(ABS)
ind <- which.max(ABS)
c(MAX, ind)
}
In [7]:
dist.norm(x)
Out[7]:
0.190 => verwerfen
In [ ]: