Learn R Programming

power.transform (version 1.0.1)

plot_qq_plot: Create Q-Q plot

Description

Create a figure that plots the expected, theoretical normal quantiles (z-scores) against the observed normal quantiles (z-scores) of the data.

Usage

plot_qq_plot(
  x,
  transformer,
  show_original = TRUE,
  show_identity = TRUE,
  use_alpha = TRUE,
  ggtheme = NULL
)

Value

A ggplot2 plot object for a Q-Q plot.

Arguments

x

A vector with numeric values that should be transformed to normality.

transformer

A transformer object created using find_transformation_parameters.

show_original

Show quantiles for original, untransformed, data in addition to transformed data.

show_identity

Show identity line that indicates equivalence between expected and observed quantiles.

use_alpha

Use transparency for points in case the data contains many instances.

ggtheme

ggplot2 theme to use for the plot. If not provided, ggplot2::theme_light is used.

Examples

Run this code
x <- exp(stats::rnorm(1000))
transformer <- find_transformation_parameters(
  x = x,
  method = "box_cox")

if (rlang::is_installed("ggplot2")) {
  plot_qq_plot(
    x = x,
    transformer = transformer
  )
}

Run the code above in your browser using DataLab