Plots a discrete/categorical cumulative distribution function.

cdf.plot(
  x,
  y,
  sort = FALSE,
  xlim,
  ylim = range(c(0, y)),
  xlab = "x",
  ylab = "F(x)",
  main = "",
  add = FALSE,
  verticals = TRUE,
  do.points = TRUE,
  pch = 20,
  col = 1,
  col.points = col,
  cex.points = 1,
  col.vert = col,
  lty = 1,
  lwd = 2,
  lty.vert = 3,
  lwd.vert = 1,
  ...
)

Arguments

x

numeric vector giving the possible values of the discrete random variable.

y

numeric vector giving the cumulative probabilities corresponding to x.

sort

logical; if FALSE (default), the x values are assumed to be in ascending order.

xlim, ylim

the x and y limits of the plot.

xlab, ylab

the axis titles.

main

an overall title for the plot.

add

logical; if TRUE add to an already existing plot, else generate a new plot.

verticals

logical; if TRUE, draw vertical lines at steps.

do.points

logical; if TRUE (default), draw points at the knot locations.

pch

point character or symbol if do.points.

col

default color of all points and lines.

col.points

color of points if do.points.

cex.points

symbol expansion factor if do.points.

col.vert

color of vertical lines.

lty, lwd

line type and thickness for horizontal lines.

lty.vert, lwd.vert

line type and thickness for vertical lines.

...

further graphical arguments (passed to plot.default() or to segments()).

Value

Returns a numeric vector with the random deviates and an attribute ngen

with the required number of uniform generations.

See also

Examples

n <- 5
p <- 0.5
x <- 0:n
y <- pbinom(x, size = n, prob = p)
cdf.plot(x, y,
    main = paste0("B(", n,", ", p, ") cumulative distribution function"))