Distribution: Distribution class

Description Details Public fields Methods

Description

Distribution class

Distribution class

Details

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

Public fields

pdf

the density function

invCdf

the centile function

cdf

the distribution function

dots

the parameters of the pdf

Methods

Public methods


Method new()

Creates a distribution

Usage
Distribution$new(density, quantile, distribution, ...)
Arguments
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


Method p()

calculate the probability density at x

Usage
Distribution$p(x)
Arguments
x

a vector of values of x

Returns

a vector of values of (p(x))


Method bigP()

calculate the cumulative density at x

Usage
Distribution$bigP(x)
Arguments
x

a vector of values of x

Returns

a vector of values of (P(x))


Method q()

calculate the value of x for a centile y

Usage
Distribution$q(y)
Arguments
y

a vector of centiles

Returns

a vector of values of x


Method getPdf()

the PDF and CDF for a distribution as a dataframe

Usage
Distribution$getPdf(xmin, xmax, resolution = 1001)
Arguments
xmin

the smallest value

xmax

the smallest value

resolution

the number of increments in x

Returns

a dataframe


Method getInverseCdf()

defines a inverse CDF as a data frame

Usage
Distribution$getInverseCdf(resolution = 1001)
Arguments
resolution

the number of increments in y

Returns

a dataframe


Method theoreticalEntropy()

calculates the integral of -p(x)*log(p(x)) from -Infinity to Infinity

Usage
Distribution$theoreticalEntropy()
Returns

a value


Method label()

gets a label for this distribution based on the parameters passed

Usage
Distribution$label()
Returns

a string


Method inverse()

gets a label for this distribution based on the parameters passed

Usage
Distribution$inverse(y)
Arguments
y

a vector of y values to apply the quantile function to

Returns

a daat frame of y and corresponding x values


Method sample()

produce a set of samples conforming to this distribution

Usage
Distribution$sample(n = 10)
Arguments
n

the number of samples

Returns

a data frame of samples (labelled x)


Method plot()

plot this dictributions as pdf and cdf

Usage
Distribution$plot(xmin, xmax, resolution = 1001)
Arguments
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)

Returns

a ggassemble plot object


Method twoDp()

a 2 dp formatter

Usage
Distribution$twoDp(x, unit = "")
Arguments
x

a number

unit

a unit


Method clone()

The objects of this class are cloneable with this method.

Usage
Distribution$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


terminological/classifier-result documentation built on March 14, 2020, 8:04 a.m.