Learn R Programming

rmngb (version 0.6-1)

qqplot2: Quantile-Quantile Plots using arbitrary distributions.

Description

Produces a QQ plot of the values in y against the theoretical quantiles of an arbitrary distribution.

Usage

qqplot2(y, fQuant = function(q, x) qnorm(q, mean(x, na.rm = TRUE), sd(x, na.rm = TRUE)), line = TRUE, xlab = "Theoretical Quantiles", ...)

Arguments

y
the data sample.
fQuant
a function taking 2 arguments. The first argument is a vector of quantiles, the second is the data sample. This function returns theoretical quantile values.
line
logical. Should a line representing perfect fit be plotted?
xlab
xlab value.
...
additional arguments passed to qqplot.

Value

Nothing of interest.

See Also

qqplot.

Examples

Run this code
y1 <- rnorm(500)
y2 <- rlnorm(500)

# good fit
qqplot2(y1)
# bad fit
qqplot2(y2)

# defining a new fQuant function
fQuant2 <- function(q, x)
    qlnorm(q, mean(log(x)), sd(log(x)))

# better fit
qqplot2(y2, fQuant2)

Run the code above in your browser using DataLab