ppPlot {r6qualitytools} | R Documentation |
ppPlot: Probability Plots for various distributions
Description
Function ppPlot
creates a Probability plot of the values in x including a line.
Usage
ppPlot(
x,
distribution,
confbounds = TRUE,
alpha,
probs,
main,
xlab,
ylab,
xlim,
ylim,
border = "red",
bounds.col = "black",
bounds.lty = 1,
start,
showPlot = TRUE,
axis.y.right = FALSE,
bw.theme = FALSE
)
Arguments
x |
Numeric vector containing the sample data for the |
distribution |
Character string specifying the distribution of x. The function
By default |
confbounds |
Logical value: whether to display confidence bounds. Default is |
alpha |
Numeric value: significance level for confidence bounds, default is '0.05'. |
probs |
Vector containing the percentages for the y axis. All the values need to be between '0' and '1'. If 'probs' is missing it will be calculated internally. |
main |
Character string: title of the plot. |
xlab |
Character string: label for the x-axis. |
ylab |
Character string: label for the y-axis. |
xlim |
Numeric vector of length 2: limits for the x-axis. |
ylim |
Numeric vector of length 2: limits for the y-axis. |
border |
Character or numeric: color for the border of the line through the quantiles. Default is |
bounds.col |
Character or numeric: color for the confidence bounds lines. Default is |
bounds.lty |
Numeric or character: line type for the confidence bounds lines. This can be specified with either an integer (0-6) or a name:
Default is '1' (solid line). |
start |
A named list giving the parameters to be fitted with initial values. Must be supplied for some distributions (see Details). |
showPlot |
Logical value indicating whether to display the plot. By default, |
axis.y.right |
Logical value indicating whether to display the y-axis on the right side. By default, |
bw.theme |
Logical value indicating whether to use a black-and-white theme from the |
Details
Distribution fitting is performed using the FitDistr
function from this package.
For the computation of the confidence bounds, the variance of the quantiles is estimated using the delta method,
which involves the estimation of the observed Fisher Information matrix as well as the gradient of the CDF of the fitted distribution.
Where possible, those values are replaced by their normal approximation.
Value
The function ppPlot
returns an invisible list containing:
x |
x coordinates. |
y |
y coordinates. |
int |
Intercept. |
slope |
Slope. |
plot |
The generated PP plot. |
See Also
Examples
set.seed(123)
ppPlot(rnorm(20, mean=90, sd=5), "normal",alpha=0.30)
ppPlot(rcauchy(100), "cauchy")
ppPlot(rweibull(50, shape = 1, scale = 1), "weibull")
ppPlot(rlogis(50), "logistic")
ppPlot(rlnorm(50) , "log-normal")
ppPlot(rbeta(10, 0.7, 1.5),"beta")
ppPlot(rpois(20,3), "poisson")
ppPlot(rchisq(20, 10),"chi-squared")
ppPlot(rgeom(20, prob = 1/4), "geometric")
ppPlot(rnbinom(n = 20, size = 3, prob = 0.2), "negative binomial")
ppPlot(rf(20, df1 = 10, df2 = 20), "f")