Description Usage Arguments Details Author(s) References See Also Examples
Plots an empirical distribution (noncensored data) with a theoretical one if specified.
1 2 
data 
A numeric vector. 
distr 
A character string 
para 
A named list giving the parameters of the named distribution. This argument may be
omitted only if 
histo 
A logical to plot the histogram using the

breaks 
If 
demp 
A logical to plot the empirical density on the first plot
(alone or superimposed on the histogram depending of the value of the argument 
discrete 
If TRUE, the distribution is considered as discrete.
If both 
... 
further graphical arguments passed to graphical functions used in plotdist. 
Empirical and, if specified, theoretical distributions are plotted
in density and in cdf. For the plot in density, the user can use the arguments
histo
and demp
to specify if he wants the histogram using the function
hist
, the density plot using the function density
, or both
(at least one of the two arguments must be put to "TRUE"
).
For continuous distributions, the function hist
is used with its default
breaks definition if breaks
is "default"
or passing breaks
as an argument if it differs
from "default"
. For continuous distribution and when a theoretical distribution is specified
by both arguments distname
and para
, QQ plot
(plot of the quantiles of the theoretical fitted distribution (xaxis) against the empirical quantiles of the data)
and PP plot (i.e. for each value of the data set, plot of the cumulative density function of the fitted distribution
(xaxis) against the empirical cumulative density function (yaxis)) are also given (Cullen and Frey, 1999).
The function ppoints
(with default parameter for argument a)
is used for the QQ plot, to generate the set of probabilities at
which to evaluate the inverse distribution.
NOTE THAT FROM VERSION 0.43, ppoints
is also used for PP plot and cdf plot for continuous data.
To personalize the four plots proposed for continuous data, for example to change the plotting position, we recommend
the use of functions cdfcomp
, denscomp
, qqcomp
and ppcomp
.
MarieLaure DelignetteMuller and Christophe Dutang.
Cullen AC and Frey HC (1999), Probabilistic techniques in exposure assessment. Plenum Press, USA, pp. 81155.
DelignetteMuller ML and Dutang C (2015), fitdistrplus: An R Package for Fitting Distributions. Journal of Statistical Software, 64(4), 134.
graphcomp
, descdist
, hist
, plot
, plotdistcens
and ppoints
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39  # (1) Plot of an empirical distribution with changing
# of default line types for CDF and colors
# and optionally adding a density line
#
set.seed(1234)
x1 < rnorm(n=30)
plotdist(x1)
plotdist(x1,demp = TRUE)
plotdist(x1,histo = FALSE, demp = TRUE)
plotdist(x1, col="blue", type="b", pch=16)
plotdist(x1, type="s")
# (2) Plot of a discrete distribution against data
#
set.seed(1234)
x2 < rpois(n=30, lambda = 2)
plotdist(x2, discrete=TRUE)
plotdist(x2, "pois", para=list(lambda = mean(x2)))
plotdist(x2, "pois", para=list(lambda = mean(x2)), lwd="2")
# (3) Plot of a continuous distribution against data
#
xn < rnorm(n=100, mean=10, sd=5)
plotdist(xn, "norm", para=list(mean=mean(xn), sd=sd(xn)))
plotdist(xn, "norm", para=list(mean=mean(xn), sd=sd(xn)), pch=16)
plotdist(xn, "norm", para=list(mean=mean(xn), sd=sd(xn)), demp = TRUE)
plotdist(xn, "norm", para=list(mean=mean(xn), sd=sd(xn)),
histo = FALSE, demp = TRUE)
# (4) Plot of serving size data
#
data(groundbeef)
plotdist(groundbeef$serving, type="s")
# (5) Plot of numbers of parasites with a Poisson distribution
data(toxocara)
number < toxocara$number
plotdist(number, discrete = TRUE)
plotdist(number,"pois",para=list(lambda=mean(number)))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.