Last data update: 2014.03.03

R: Range of a normal inverse Gaussian Distribution
nigCalcRangeR Documentation

Range of a normal inverse Gaussian Distribution

Description

Given the parameter vector param of a normal inverse Gaussian distribution, this function calculates the range outside of which the distribution has negligible probability, or the density function is negligible, to a specified tolerance. The parameterization used is the (alpha, beta) one (see dnig). To use another parameterization, use hyperbChangePars.

Usage

nigCalcRange(mu = 0, delta = 1, alpha = 1, beta = 0,
                param = c(mu, delta, alpha, beta),
                tol = 10^(-5), density = TRUE, ...)

Arguments

mu

mu is the location parameter. By default this is set to 0.

delta

delta is the scale parameter of the distribution. A default value of 1 has been set.

alpha

alpha is the tail parameter, with a default value of 1.

beta

beta is the skewness parameter, by default this is 0.

param

Value of parameter vector specifying the normal inverse Gaussian distribution. This takes the form c(mu, delta, alpha, beta).

tol

Tolerance.

density

Logical. If FALSE, the bounds are for the probability distribution. If TRUE, they are for the density function.

...

Extra arguments for calls to uniroot.

Details

The particular normal inverse Gaussian distribution being considered is specified by the parameter value param.

If density = FALSE, the function calculates the effective range of the distribution, which is used in calculating the distribution function and quantiles, and may be used in determining the range when plotting the distribution. By effective range is meant that the probability of an observation being greater than the upper end is less than the specified tolerance tol. Likewise for being smaller than the lower end of the range. Note that this has not been implemented yet.

If density = TRUE, the function gives a range, outside of which the density is less than the given tolerance. Useful for plotting the density.

Value

A two-component vector giving the lower and upper ends of the range.

Author(s)

David Scott d.scott@auckland.ac.nz, Christine Yang Dong

References

Barndorff-Nielsen, O. and Bl<c3><a6>sild, P (1983). Hyperbolic distributions. In Encyclopedia of Statistical Sciences, eds., Johnson, N. L., Kotz, S. and Read, C. B., Vol. 3, pp. 700–707. New York: Wiley.

Paolella, Marc S. (2007) Intermediate Probability: A Computational Approach, Chichester: Wiley

See Also

dnig, hyperbChangePars

Examples

par(mfrow = c(1, 2))
param <- c(0, 1, 3, 1)
nigRange <- nigCalcRange(param = param, tol = 10^(-3))
nigRange
curve(pnig(x, param = param), nigRange[1], nigRange[2])
maxDens <- dnig(nigMode(param = param), param = param)
nigRange <- nigCalcRange(param = param, tol = 10^(-3) * maxDens, density = TRUE)
nigRange
curve(dnig(x, param = param), nigRange[1], nigRange[2])

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(GeneralizedHyperbolic)
Loading required package: DistributionUtils
Loading required package: RUnit
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GeneralizedHyperbolic/nigCalcRange.Rd_%03d_medium.png", width=480, height=480)
> ### Name: nigCalcRange
> ### Title: Range of a normal inverse Gaussian Distribution
> ### Aliases: nigCalcRange
> ### Keywords: distribution
> 
> ### ** Examples
> 
> par(mfrow = c(1, 2))
> param <- c(0, 1, 3, 1)
> nigRange <- nigCalcRange(param = param, tol = 10^(-3))
> nigRange
[1] -1.884467  3.518054
> curve(pnig(x, param = param), nigRange[1], nigRange[2])
> maxDens <- dnig(nigMode(param = param), param = param)
> nigRange <- nigCalcRange(param = param, tol = 10^(-3) * maxDens, density = TRUE)
> nigRange
[1] -1.959399  3.658918
> curve(dnig(x, param = param), nigRange[1], nigRange[2])
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>