Description Details Public fields Methods
Distribution class
Distribution class
The distribution class wrapps PDF and Quatile functions from a number of distributions and provides some simple stats for those functions, including a sampling function
pdf
the density function
invCdf
the centile function
cdf
the distribution function
dots
the parameters of the pdf
new()
Creates a distribution
Distribution$new(density, quantile, distribution, ...)
density
a function that accepts at least a vector of x value (e.g. dnorm)
quantile
a function that accepts at least a vector of p values (e.g. qnorm)
...
passed to pdfFunction and centileFunction
p()
calculate the probability density at x
Distribution$p(x)
x
a vector of values of x
a vector of values of (p(x))
bigP()
calculate the cumulative density at x
Distribution$bigP(x)
x
a vector of values of x
a vector of values of (P(x))
q()
calculate the value of x for a centile y
Distribution$q(y)
y
a vector of centiles
a vector of values of x
getPdf()
the PDF and CDF for a distribution as a dataframe
Distribution$getPdf(xmin, xmax, resolution = 1001)
xmin
the smallest value
xmax
the smallest value
resolution
the number of increments in x
a dataframe
getInverseCdf()
defines a inverse CDF as a data frame
Distribution$getInverseCdf(resolution = 1001)
resolution
the number of increments in y
a dataframe
theoreticalEntropy()
calculates the integral of -p(x)*log(p(x)) from -Infinity to Infinity
Distribution$theoreticalEntropy()
a value
label()
gets a label for this distribution based on the parameters passed
Distribution$label()
a string
inverse()
gets a label for this distribution based on the parameters passed
Distribution$inverse(y)
y
a vector of y values to apply the quantile function to
a daat frame of y and corresponding x values
sample()
produce a set of samples conforming to this distribution
Distribution$sample(n = 10)
n
the number of samples
a data frame of samples (labelled x)
plot()
plot this dictributions as pdf and cdf
Distribution$plot(xmin, xmax, resolution = 1001)
xmin
the minimum of the support range to plot
xmax
the maximum of the support range to plot
resolution
the number of points to generate for the plot (default 1001)
a ggassemble plot object
twoDp()
a 2 dp formatter
Distribution$twoDp(x, unit = "")
x
a number
unit
a unit
clone()
The objects of this class are cloneable with this method.
Distribution$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.