surveillance (version 1.12.1)

ks.plot.unif: Plot the ECDF of a uniform sample with Kolmogorov-Smirnov bounds

Description

This plot function takes a univariate sample that should be tested for a U(0,1) distribution, plots its empirical cumulative distribution function (ecdf), and adds a confidence band by inverting the corresponding Kolmogorov-Smirnov test (ks.test). The uniform distribution is rejected if the ECDF is not completely inside the confidence band.

Usage

ks.plot.unif(U, conf.level = 0.95, exact = NULL,
             col.conf = "gray", col.ref = "gray",
             xlab = expression(u[(i)]), ylab = "Cumulative distribution")

Arguments

U
numeric vector containing the sample. Missing values are (silently) ignored.
conf.level
confidence level for the K-S-test (defaults to 0.95), can also be a vector of multiple levels.
exact
see ks.test.
col.conf
colour of the confidence lines.
col.ref
colour of the diagonal reference line.
xlab, ylab
axis labels.

Value

  • NULL (invisibly).

encoding

latin1

See Also

ks.test for the Kolmogorov-Smirnov test, as well as checkResidualProcess, which makes use of this plot function.

Examples

Run this code
samp <- runif(99)
ks.plot.unif(samp, conf.level=c(0.95, 0.99), exact=TRUE)
ks.plot.unif(samp, conf.level=c(0.95, 0.99), exact=FALSE)

Run the code above in your browser using DataCamp Workspace