The qqplotr package extends some ggplot2 functionalities by
permitting the drawing of both quantile-quantile (Q-Q) and
probability-probability (P-P) points, lines, and confidence bands. The
functions of this package also allow a detrend adjustment of the plots,
proposed by Thode (2002) to help reduce visual bias when assessing the
results.
Installation
If you would like to install the development version of qqplotr, you
may do so by using, for example, devtools:
# install.packages("devtools") library(devtools) devtools::install_github("aloy/qqplotr")
If, instead, you wish to install the stable CRAN version, then simply do:
install.packages("qqplotr")Details
The functions of this package, implemeneted as Stats from ggplot2, are
divided into two groups: (1) Q-Q and (2) P-P plots.
Both groups are composed of three functions: point, line, and band. Those Stats complement each other when drawn together, but they may also be plotted independently.
Below we will give an overview of all those Stats and, further in the document, we will present some usage examples.
Q-Q plot
stat_qq_pointThis is a modified version ofggplot2::stat_qqwith some parameters adjustments and a new option to detrend the points.stat_qq_lineDraws a reference line based on the data quantiles, as instats::qqline.stat_qq_bandDraws confidence bands based on three methods:"pointwise","boot","ks", and"ts":"pointwise"constructs simultaneous confidence bands based on the normal distribution;"boot"creates pointwise confidence bands based on a parametric boostrap;"ks"constructs simultaneous confidence bands based on an inversion of the Kolmogorov-Smirnov test;"ts"constructs tail-sensitive confidence bands, as proposed by Aldor-Noiman et al. (2013).
In order to facilitate the visualization of multiple Q-Q band methods at
the same time, the geom_qq_band Geom was also implemented. Its usage
will be illustrated further below.
P-P plot
-
stat_pp_pointPlots cumulative probabilities versus probability points. The cumulative probability function is constructed with the sample data, and then evaluated at each probability point. -
stat_pp_lineDraws a reference identity line (