plot_density: Plot the desity function

View source: R/ACutils_export.R

plot_densityR Documentation

Plot the desity function

Description

\loadmathjax

This function plots the density function of some know distributions. Current version, does not allow to overlap different plots if use_ggplot is active. Though, it is possible when using standard plots. In such a case, the legend can be added a posteriori.

Usage

plot_density(
  ...,
  dist,
  main = " ",
  x_label = " ",
  y_label = " ",
  xlim = NULL,
  ylim = NULL,
  col = "gray48",
  use_x11_device = TRUE,
  use_ggplot = FALSE,
  add = FALSE
)

Arguments

...

the list of parameters needed by the distribution specified in dist.

dist

string with the name of the density to be plotted. Possibilities are, "norm" (requires mean and sd), "gamma" (requires shape and rate), "inv-gamma" (requires shape and scale, see below), "chi-sq" (requires dof), "exp" (requires rate), "t" (requires dop), "Fisher" (requires dof1 and dof2), "nct" (requires degree of freedom, location and scale. See dnct for the definition of such a distribution.). "laplace" (requires location and scale). The "inv-gamma" distribution is defined as follow: \mjsdeqnX~\sim~inv-gamma(shape = \alpha, scale = \beta) if \mjtdeqn$$\begineqnarray*f(X|\alpha,\beta) = \frac\beta^\alpha\Gamma(\alpha)\left(\frac1x\right)^\alpha+1e^- \frac\betaxeqnarray*$$\begineqnarray*f(X|\alpha,\beta) = \frac\beta^\alpha\Gamma(\alpha)\left(\frac1x\right)^\alpha+1e^- \frac\betax\endeqnarray*\begineqnarray* f(X|\alpha,\beta) = \frac\beta^\alpha\Gamma(\alpha)\left(\frac1x\right)^\alpha+1e^- \frac\betax\endeqnarray*

main

the title of the plot.

x_label

the name of the x-axis in the plot.

y_label

the name of the y-axis in the plot.

xlim

set the range of x-axis. Not used if add is TRUE.

ylim

set the range of y-axis. Not used if add is TRUE.

col

set color of density line.

use_x11_device

boolean, if x11() device has to be activated or not.

add

boolean, if current plot has to be added to previous plot or not.

Value

this function does not return anything


alessandrocolombi/ACutils documentation built on March 3, 2023, 4:06 a.m.