Standardized Normal Inverse Gaussian Distribution

Share:

Description

Density, distribution function, quantile function and random generation for the standardized normal inverse Gaussian distribution.

Usage

1
2
3
4
dsnig(x, zeta = 1, rho = 0, log = FALSE)
psnig(q, zeta = 1, rho = 0)
qsnig(p, zeta = 1, rho = 0)
rsnig(n, zeta = 1, rho = 0)

Arguments

zeta, rho

shape parameter zeta is positive, skewness parameter rho is in the range (-1, 1).

log

a logical flag by default FALSE. If TRUE, log values are returned.

n

number of observations.

p

a numeric vector of probabilities.

x, q

a numeric vector of quantiles.

Details

The random deviates are calculated with the method described by Raible (2000).

Value

All values for the *snig functions are numeric vectors: d* returns the density, p* returns the distribution function, q* returns the quantile function, and r* generates random deviates.

All values have attributes named "param" listing the values of the distributional parameters.

Author(s)

Diethelm Wuertz.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
   
## snig -
   set.seed(1953)
   r = rsnig(5000, zeta = 1, rho = 0.5)
   plot(r, type = "l", col = "steelblue",
     main = "snig: zeta=1 rho=0.5")
 
## snig - 
   # Plot empirical density and compare with true density:
   hist(r, n = 50, probability = TRUE, border = "white", col = "steelblue")
   x = seq(-5, 5, length = 501)
   lines(x, dsnig(x, zeta = 1, rho = 0.5))
 
## snig -  
   # Plot df and compare with true df:
   plot(sort(r), (1:5000/5000), main = "Probability", col = "steelblue")
   lines(x, psnig(x, zeta = 1, rho = 0.5))
   
## snig -
   # Compute Quantiles:
   qsnig(psnig(seq(-5, 5, 1), zeta = 1, rho = 0.5), zeta = 1, rho = 0.5) 

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.