plot_t: Plot a t Distribution with Shading

View source: R/plot_t.R

plot_tR Documentation

Plot a t Distribution with Shading

Description

Draw a t distribution curve and optional shading of a particular region.

Usage

plot_t(
  df,
  shadeValues = NULL,
  direction = c("less", "greater", "beyond", "between"),
  col.shade = "cornflowerblue",
  ...
)

Arguments

df

The degrees of freedom of the t distribution to plot

shadeValues

Either a single number or a vector of two numbers which identify the boundary or boundaries of the shaded region

direction

A character string (in quotes) indicating the direction from shadeValues to shade under the normal curve. Must be one of "less", "greater", "beyond", or "between". See Details below.

col.shade

The color of the shaded region

...

Other graphical parameters passed to plot (e.g., xlim, main, etc.). Generally, these will not control the shading, only the normal distribution curve.

Details

The direction argument is used to control the region under the normal distribution curve which is shaded. If shadeValues is a single number, direction must be either "less" (in which case the shaded region will be to the left of shadeValues) or "greater" (the shaded region will be to the right of shadeValues).

If shadeValues is a vector, then direction must be either "between" (the region between the two numbers in shadeValues will be shaded) or "beyond" (the region below the smaller and above the larger of the shadeValues will be shaded).

Value

A plot of a normal distribution curve with optional shading.

See Also

plot_norm

Examples

# Shade the region below 1.4 on the t(4) distribution.
plot_t(df = 4, shadeValues = 1.4, direction = "less")

# Shade the region between -2 and 0.5 on the t(13) distribution.
plot_t(df = 13, shadeValues = c(-2, 0.5), direction = "between")

STATS250SBI/stats250sbi documentation built on March 18, 2022, 1:14 p.m.