qq_line_coeffs: Compute a slope and an intercept for a reference line in a...

Description Usage Arguments Details Value Examples

View source: R/qq_line_coeffs.R

Description

Compute a slope and an intercept for a reference line ("qq-line") in a quantile comparison plot given a vector of data an a theoretical distribution.

Usage

1
2
3
4
5
6
7
8
9
qq_line_coeffs(
  y,
  datax = FALSE,
  distribution = qnorm,
  probs = c(0.25, 0.75),
  qtype = 7,
  na.rm = TRUE,
  ...
)

Arguments

y

(numeric) A numeric vector.

datax

logical. Should data values be on the x-axis?

distribution

quantile function for reference theoretical distribution.

probs

numeric vector of length two, representing probabilities. Corresponding quantile pairs define the line drawn.

qtype

the type of quantile computation used in quantile.

na.rm

logical; if true, any NA and NaN's are removed from x before the quantiles are computed.

...

Further arguments for distribution.

Details

The code is based on code of qqline() in package stats. But instead of plotting a reference line, it returns its coefficients.

Value

A vector with a slope and an intercept for a qq-line.

Examples

1
2
3
4
set.seed(254)
x <- rnorm(50)

qq_line_coeffs(x)

GegznaV/BioStat documentation built on Aug. 14, 2020, 9:30 p.m.