R: Parameter Sets for the Normal Inverse Gaussian Distribution
nigParam
R Documentation
Parameter Sets for the Normal Inverse Gaussian Distribution
Description
These objects store different parameter sets of the normal inverse
Gaussian distribution as matrices for testing or demonstration
purposes.
The parameter sets nigSmallShape and
nigLargeShape have a constant location parameter of
mu = 0, and constant scale parameter delta =
1. In nigSmallParam and nigLargeParam the values of
the location and scale parameters vary. In these parameter sets the
location parameter mu = 0 takes values from {0, 1} and
{-1, 0, 1, 2} respectively. For the scale parameter
delta, values are drawn from {1, 5} and {1, 2, 5,
10} respectively.
For the shape parameters alpha and beta the
approach is more complex. The values for these shape parameters were
chosen by choosing values of xi and chi which
range over the shape triangle, then the function nigChangePars
was applied to convert them to the alpha, beta
parameterization. See the examples for the values of xi and
chi for the large parameter sets.
data(nigParam)
plotShapeTriangle()
xis <- rep(c(0.1,0.3,0.5,0.7,0.9), 1:5)
chis <- c(0,-0.25,0.25,-0.45,0,0.45,-0.65,-0.3,0.3,0.65,
-0.85,-0.4,0,0.4,0.85)
points(chis, xis, pch = 20, col = "red")
## Testing the accuracy of nigMean
for (i in 1:nrow(nigSmallParam)) {
param <- nigSmallParam[i, ]
x <- rnig(1000, param = param)
sampleMean <- mean(x)
funMean <- nigMean(param = param)
difference <- abs(sampleMean - funMean)
print(difference)
}
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/nigParam.Rd_%03d_medium.png", width=480, height=480)
> ### Name: nigParam
> ### Title: Parameter Sets for the Normal Inverse Gaussian Distribution
> ### Aliases: nigParam nigSmallShape nigLargeShape nigSmallParam
> ### nigLargeParam
>
> ### ** Examples
>
> data(nigParam)
> plotShapeTriangle()
> xis <- rep(c(0.1,0.3,0.5,0.7,0.9), 1:5)
> chis <- c(0,-0.25,0.25,-0.45,0,0.45,-0.65,-0.3,0.3,0.65,
+ -0.85,-0.4,0,0.4,0.85)
> points(chis, xis, pch = 20, col = "red")
>
>
> ## Testing the accuracy of nigMean
> for (i in 1:nrow(nigSmallParam)) {
+ param <- nigSmallParam[i, ]
+ x <- rnig(1000, param = param)
+ sampleMean <- mean(x)
+ funMean <- nigMean(param = param)
+ difference <- abs(sampleMean - funMean)
+ print(difference)
+ }
[1] 0.0005446838
[1] 0.03053946
[1] 0.04320501
[1] 0.04120016
[1] 0.0003034942
[1] 0.05964697
[1] 0.1007683
[1] 0.008259733
[1] 0.08602838
[1] 0.1515251
[1] 0.07714651
[1] 0.02651626
[1] 0.03656451
[1] 0.4301991
[1] 0.006592722
[1] 0.0127067
[1] 0.005039324
[1] 0.1495574
[1] 0.06810481
[1] 0.05653211
[1] 0.1073736
[1] 0.02507756
[1] 0.1321643
[1] 0.006780526
[1] 0.7779784
[1] 0.05658183
[1] 0.2546927
[1] 0.4726796
>
>
>
>
>
>
> dev.off()
null device
1
>