plotDistribution {MDMA}R Documentation

Plot a probability distribution

Description

Plot the density function of certain probability distributions.

[Stable]

Usage

plotDistribution(
  distribution = c("normal", "t", "chi2", "F"),
  xRange = c(0, 5),
  xColArea = NULL,
  xAreaCol = NULL,
  mean = 0,
  sd = 1,
  df,
  df1,
  df2,
  ncp,
  ...
)

Arguments

distribution

the probability distribution for which a plot should be drawn. Currently, the options are "normal", "t", "chi2" and "F".

xRange

Range of x axis over which the distribution should be drawn.

xColArea

Optional, a matrix with two columns, where each row contains lower and upper bounds for intervals that should be colored under the pdf curve.

xAreaCol

Optional, should contain (a) color(s) for the interval colors in xColArea. Defaults to "red". Should either be length 1 or length length(xColArea).

mean

mean for the normal distribution.

sd

sd for the normal distribution.

df

df for the t distribution.

df1

first df for the F distribution.

df2

second df for the F distribution.

ncp

non-centrality parameter

...

other arguments to be forwarded to the plot function.

Value

plotDistribution returns a probability density plot.

Author(s)

Mathijs Deen

Examples

plotDistribution(distribution = "normal",
                 xRange       = c(-5, 5),
                 xColArea     = matrix(data  = c(-5, -1.96,
                                                 1.96, 5),
                                       ncol  = 2,
                                       byrow = TRUE),
                 xAreaCol     = c("green", "blue"),
                 mean         = 0,
                 sd           = 1,
                 yaxt         = "n",
                 ylab         = "")

[Package MDMA version 1.1.0 Index]