plot_discrete_cdf: Draw the CDF for a discrete random variable

View source: R/plot_discrete_cdf.R

plot_discrete_cdfR Documentation

Draw the CDF for a discrete random variable

Description

Draw the CDF for a discrete random variable

Usage

plot_discrete_cdf(x, fx, col = "blue", lwd = 3, ...)

Arguments

x

vector with the values of the random variable X.

fx

vector with the probabilities of X.

col

color for the line.

lwd

line width.

...

further arguments and graphical parameters.

Value

A plot with the cumulative distribution function.

Author(s)

Freddy Hernandez, fhernanb@unal.edu.co

Examples

# Example 1
# for a particular distribution

x <- 1:6
fx <- c(0.19, 0.21, 0.4, 0.12, 0.05, 0.03)
plot_discrete_cdf(x, fx, las=1, main="")

# Example 2
# for a Poisson distribution
x <- 0:10
fx <- dpois(x, lambda=3)
plot_discrete_cdf(x, fx, las=1,
                  main="CDF for Poisson")

DiscreteDists documentation built on Sept. 14, 2024, 1:07 a.m.