Learn R Programming

energyGOF (version 0.1)

asymmetric_laplace_dist: Create an asymmetric Laplace distribution object for energy testing

Description

Create an S3 object that sets all the required data needed by energyGOFdist to execute the energy goodness-of-fit test against an asymmetric Laplace distribution. If all three parameters are NULL, perform a composite test. This is exactly the distribution corresponding to the PDF

$$ f(x | \theta, \sigma, \kappa) = \frac{\sqrt{2}\kappa}{\sigma(1 + \kappa^2)} \begin{cases} \exp\Big( -\frac{\sqrt{2} \kappa |x - \theta|}{\sigma} \Big), & x \ge \theta, \\[6pt] \exp\Big( -\frac{\sqrt{2} |x - \theta|}{\kappa \sigma} \Big), & x < \theta. \end{cases} , $$

where \(\theta\) = location, \(\sigma\) = scale, and \(\kappa\) = skew.

Usage

asymmetric_laplace_dist(location = NULL, scale = NULL, skew = NULL)

alaplace_dist(location = NULL, scale = NULL, skew = NULL)

Value

S3 data object containing the following fields.

  • name: String

  • composite_p: Composite predicate. TRUE if test is composite.

  • par: Distribution parameters, list of the formals.

  • sampler_par: Distribution parameters used for the calculation of energy statistic. These may be different than par.

  • par_domain: Function used to ensure par and sampler_par are valid for this distribution

  • support: Function to check that data x can be tested against y

  • sampler: Function used for rng by boot::boot()

  • EYY: Function to compute \(E|Y-Y'|\) (or \(E|Y-Y'|^{pow}\), for the generalized test.)

  • EXYhat: Function to compute \(\frac{1}{n} \sum_i E|x_i - Y|\) (or \(\frac{1}{n} \sum_i E|x_i - Y|^{pow}\)), where Y is distributed according to y and x is the data under test (which is passed in egof.test or egofd).

  • xform: Function that may be used to transform x. Only available in certain distribution objects.

  • statistic: Function that returns a list of maximum likelihood estimates. Only available in certain distribution objects.

  • notes: Distribution specific messages. Only used in certain distribution objects.

Note: Some distributions do not have notes, xform, and statistic fields. This is because either a composite test is not implemented, or because a data transformation is not needed.

Arguments

location

NULL, or a location parameter

scale

NULL, or a positive scale parameter

skew

NULL, or a positive skewness parameter. Skew = 1 corresponds to a symmetric Laplace distribution (though note the difference between the PDF in this description and the one in laplace_dist()).

Author

John T. Haman

Examples

Run this code

d <- asymmetric_laplace_dist(0, 1, .5)
x <- d$sampler(10, d$par)

egofd(x, d, 0)


Run the code above in your browser using DataLab