Description Usage Arguments Details Value Author(s) Examples
computes and plots the empirical cumulative distribution function (ecdf). Also plots models over the ecdf
1 2 3 |
x |
a vector of values for which the histogram is desired. |
distr |
a character string of the distribution name. See the examples below and ?distributions. Default to NULL to plot just the empirical DCF. |
para |
A named list giving the parameters of the named distribution. Default to NULL to plot just the empirical DCF |
xlim |
the x limits (x1, x2) of the plot. x1 > x2. |
main |
a main title for the plot, see also title. Default to "CDF". |
xlab |
a label for the x axis, defaults to a description of x. |
ylab |
a label for the y axis, defaults to "CDF". |
col |
a character string of the points color. See ?par |
pch |
character style. Default to 20. see points.default |
cex |
Magnification of points. Defatult to 1.8 |
lcol |
a character string of the line color of the model curve. See "col" in ?par |
lty |
a character string of the line type of the model curve. See ?par |
lwd |
a character string of the line width of the model curve. See ?par |
... |
further arguments passed to plot |
This function is based on the function plotdist from the package fitdistrplus
a list with: CDF. A data.frame with the sorted input values in the first column and the CDF values in the second column xlim. A vector with the limits of the x axis
Francisco Mendoza-Torres (mentofran@gmail.com)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # EXAMPLE 1: NORMAL DISTRIBUTION (EMPIRICAL CDF)
set.seed(123)
MEAN <- 2
SD <- 0.5
X <- rnorm(n = 300, mean = MEAN, sd = SD)
Results <- CDF(x = X, main = "Empirical CDF") # Empirical CDF
# EXAMPLE 2: NORMAL DISTRIBUTION (MODEL OVER THE EMPIRICAL CDF)
PARA <- list(mean = MEAN, sd = SD)
Results <- CDF(x = X, distr = "norm", para = PARA)
CDF(x = X, distr = "norm", para = PARA, col = "orange")
CDF(x = X, distr = "norm", para = PARA, col = "orange", main = "Test Main")
CDF(x = X, distr = "norm", para = PARA, col = "orange", main = "Test Main", pch = "i")
CDF(x = X, distr = "norm", para = PARA, col = "orange", main = "Test Main", pch = "i",
lcol = "blue", lwd = 3)
# EXAMPLE 3: EXPONENTIAL DISTRIBUTION
set.seed(123)
RATE <- 0.5
X <- rexp(300, RATE)
PARA <- list(rate = RATE)
Results <- CDF(x = X, distr = "exp", para = PARA)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.