qqexp | R Documentation |
Produces a QQ plot to compare ordered sample data to corresponding quantiles of an exponential distribution fitted to these data.
qqexp(
y,
statistic = c("mean", "median"),
type = 6,
envelopes = FALSE,
...,
line = list(col = "black", lty = 1, lwd = 1)
)
y |
Sample data |
statistic |
A character scalar. Selects the summary statistic used to
estimate |
type |
An integer scalar. If |
envelopes |
Determines whether or not simulation envelopes should be
added to the plot. If |
... |
Optional arguments to be passed to
|
line |
Determines whether or not a line of equality is superimposed on
the plot. If a line is required then must be a list, which can contain
|
The rate parameter \lambda
of the exponential distribution
is estimated using 1/mean(y, na.rm = TRUE)
if
statistic = "mean"
and
log(2)/quantile(y, probs = 0.5, na.rm = TRUE)
if
statistic = "median"
. The ordered sample data are plotted against
quantiles of this fitted exponential distribution. Specifically, the
i
th smallest sample observation is plotted against the
100 i / (n + 1)\%
theoretical exponential quantile, where n
is
the sample size. The plot is constrained to be square. A line of equality
is superimposed on the plot.
The estimate of \lambda
.
qqnorm
to produce a normal QQ plot.
## Australian Birth Times Data
# Calculate the waiting times until each birth
waits <- diff(c(0, aussie_births[, "time"]))
# Estimating lambda using the sample mean
qqexp(waits)
# Change the appearance of the points and line
qqexp(waits, pch = 16, line = list(lty = 2, col = "blue", lwd = 2))
# Add simulation envelopes
qqexp(waits, envelopes = 19)
# Estimating lambda using the sample median
qqexp(waits, statistic = "median", envelopes = 19)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.