In [1]:
x <- scan("rn01.txt")
x <- sort(x)
n <- length(x)
n


Out[1]:
40

a)


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]:
plot(x, Fn, type="s", lwd=1, ylab="", xlab="x", main="95% KS-Konfidenzband")
d <- 1.36/sqrt(n)
lower_ks <- pmax(Fn - d, 0)
upper_ks <- pmin(Fn + d, 1)
conf.b.ks <- cbind(lower_ks, upper_ks)
matplot(x, conf.b.ks, type="s", col=3, add=TRUE)


b)


In [5]:
ks.test(x, pnorm)


Out[5]:
	One-sample Kolmogorov-Smirnov test

data:  x
D = 0.1243, p-value = 0.5263
alternative hypothesis: two-sided

c)


In [6]:
require(nortest)
lillie.test(x)


Loading required package: nortest
Out[6]:
	Lilliefors (Kolmogorov-Smirnov) normality test

data:  x
D = 0.10213, p-value = 0.3665

In [ ]: