Learn R Programming

nspmix (version 2.0-0)

plot.disc: Plot a discrete distribution function

Description

Class disc is used to represent an arbitrary univariate discrete distribution with a finite number of support points.

Function disc creates an object of class disc, given the support points and probability values at these points.

Function plot.disc plots the discrete distribution.

Usage

# S3 method for disc
plot(
  x,
  type = c("pdf", "cdf"),
  add = FALSE,
  col = 4,
  lwd = 1,
  ylim,
  xlab = "",
  ylab = "Probability",
  ...
)

Arguments

x

an object of class disc.

type

plot its pdf or cdf.

add

add the plot or not.

col

colour to be used.

lwd, ylim, xlab, ylab

graphical parameters.

...

arguments passed on to function plot.

Author

Yong Wang <yongwang@auckland.ac.nz>

See Also

disc, cnm, cnmms.

Examples

Run this code

plot(disc(pt=c(0,4), pr=c(0.3,0.7)))
plot(disc(rnorm(5), 1:5))
for(i in 1:5)
   plot(disc(rnorm(5), 1:5), type="cdf", add=(i>1), xlim=c(-3,3))

Run the code above in your browser using DataLab