Learn R Programming

energyGOF (version 0.1)

energyGOFdist: S3 Interface to Parametric Goodness-of-Fit Tests via Energy

Description

This is an alternative interface that provides the same parametric tests as energyGOF.test(), but allows the user to directly pass a distribution object like normal_dist() (Distribution objects are specific to the implementation of this R package). The advantage is that you do not need to pass distribution parameters into a ... argument as in energyGOF.test(). energyGOF.test() uses this function under the hood, but it's perfectly suitable for the user to use as well.

Usage

energyGOFdist(x, dist, nsim)

egofd(x, dist, nsim)

Value

Return an object of class `htest' representing the result of the energy goodness-of-fit hypothesis test. The htest object has the elements:

  • method: Simple or Composite

  • data.name

  • distribution: The distribution object created to test

  • parameter: List of parameters if the test is simple

  • nsim: Number of bootstrap replicates

  • composite_p: TRUE/FALSE composite predicate

  • statistic: The value of the energy statistic (\(Q=nE^*\))

  • p.value

  • sim_reps: bootstrap replicates of energy statistic

  • estimate: Any parameter estimates, if the test is composite

Arguments

x

A numeric vector.

dist

An object of class GOFDist. The distribution to test x against. GOFDist objects are created with the various "*_dist()" functions in this package. See, for example, normal_dist() for details on these class objects.

nsim

A non-negative integer. The number of parametric bootstrap replicates taken to calculate the p-value. If 0, no simulation.

Author

John T. Haman

Examples

Run this code
## Simple normal test
energyGOFdist(rnorm(10), normal_dist(0, 1), nsim = 10)

## Simple Poisson test
egofd(rpois(10,1), poisson_dist(1), nsim = 0) # No p-value

## Composite Normal test
egofd(rnorm(10), normal_dist(), nsim = 10)


Run the code above in your browser using DataLab