View source: R/1.3_Distr_DistrCollection_Functions.R
qqPlot | R Documentation |
Function qqPlot
creates a QQ plot of the values in x including a line which passes through the first and third quartiles.
qqPlot(
x,
y,
confbounds = TRUE,
alpha,
main,
xlab,
ylab,
xlim,
ylim,
border = "red",
bounds.col = "black",
bounds.lty = 1,
start,
showPlot = TRUE,
axis.y.right = FALSE,
bw.theme = FALSE
)
x |
The sample for qqPlot. |
y |
Character string specifying the distribution of
By default |
confbounds |
Logical value indicating whether to display confidence bounds. By default, |
alpha |
Numeric value specifying the significance level for the confidence bounds, set to '0.05' by default. |
main |
A character string for the main title of the plot. |
xlab |
A character string for the x-axis label. |
ylab |
A character string for the y-axis label. |
xlim |
A numeric vector of length 2 to specify the limits of the x-axis. |
ylim |
A numeric vector of length 2 to specify the limits of the y-axis. |
border |
A numerical value or single character string giving the color of the interpolation line. By default, |
bounds.col |
A numerical value or single character string giving the color of the confidence bounds lines. By default, |
bounds.lty |
A 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 |
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.
The function qqPlot
returns an invisible list containing:
x |
Sample quantiles. |
y |
Theoretical quantiles. |
int |
Intercept of the fitted line. |
slope |
Slope of the fitted line. |
plot |
The generated QQ plot. |
ppPlot
, FitDistr
.
set.seed(123)
qqPlot(rnorm(20, mean=90, sd=5), "normal",alpha=0.30)
qqPlot(rcauchy(100), "cauchy")
qqPlot(rweibull(50, shape = 1, scale = 1), "weibull")
qqPlot(rlogis(50), "logistic")
qqPlot(rlnorm(50) , "log-normal")
qqPlot(rbeta(10, 0.7, 1.5),"beta")
qqPlot(rpois(20,3), "poisson")
qqPlot(rchisq(20, 10),"chi-squared")
qqPlot(rgeom(20, prob = 1/4), "geometric")
qqPlot(rnbinom(n = 20, size = 3, prob = 0.2), "negative binomial")
qqPlot(rf(20, df1 = 10, df2 = 20), "f")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.