EmpiricalDistribution {rdecision}R Documentation

An empirical distribution

Description

An R6 class representing an empirical (1D) distribution.

Details

An object representing an empirical distribution. It inherits from class Distribution.

Super class

rdecision::Distribution -> EmpiricalDistribution

Methods

Public methods

Inherited methods

Method new()

Create an object of class EmpiricalDistribution.

Usage
EmpiricalDistribution$new(x, interpolate.sample = TRUE)
Arguments
x

a sample of at least 1 numerical value from the population of interest.

interpolate.sample

Logical; if true, each call to sample() make a random draw from U_{0,1} to find a p value, then finds that quantile of the sample, using the quantile function in R, via interpolation from the eCDF. If false, the sample() function makes a random draw from x.

Details

Empirical distributions based on very small sample sizes are supported, but not recommended.

Returns

An object of class EmpiricalDistribution.


Method distribution()

Accessor function for the name of the distribution.

Usage
EmpiricalDistribution$distribution()
Returns

Distribution name as character string.


Method mean()

Return the expected value of the distribution.

Usage
EmpiricalDistribution$mean()
Returns

Expected value as a numeric value.


Method mode()

Return the mode of the distribution,

Usage
EmpiricalDistribution$mode()
Returns

NA because an empirical distribution is not guaranteed to be unimodal.


Method SD()

Return the standard deviation of the distribution.

Usage
EmpiricalDistribution$SD()
Returns

Standard deviation as a numeric value


Method sample()

Draw and hold a random sample from the distribution.

Usage
EmpiricalDistribution$sample(expected = FALSE)
Arguments
expected

If TRUE, sets the next value retrieved by a call to r() to be the mean of the distribution.

Details

Samples with interpolation or by random draw from the supplied distribution (see parameter interpolate.sample in new()).

Returns

Updated distribution.


Method quantile()

Return the quantiles of the empirical uncertainty distribution.

Usage
EmpiricalDistribution$quantile(probs)
Arguments
probs

Vector of probabilities, in range [0,1].

Returns

Vector of quantiles.


Method clone()

The objects of this class are cloneable with this method.

Usage
EmpiricalDistribution$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

Andrew J. Sims andrew.sims@newcastle.ac.uk


[Package rdecision version 1.2.0 Index]