R: Computes the moment coefficients recursively for generalized...
momRecursion
R Documentation
Computes the moment coefficients recursively for generalized
hyperbolic and related distributions
Description
This function computes all of the moments coefficients by recursion based on
Scott, W<c3><bc>rtz and Tran (2008). See Details for the
formula.
Usage
momRecursion(order = 12, printMatrix = FALSE)
Arguments
order
Numeric. The order of the moment coefficients to be calculated.
Not permitted to be a vector. Must be a positive whole number except for
moments about zero.
printMatrix
Logical. Should the coefficients matrix be printed?
Details
The moment coefficients recursively as a_{1,1}=1 and
a_{k,l} = a_{k-1,l=1} + (2l - k + 1) a_{k-1,l}
with
a_k,l = 0 for
l < [(k + 1)/2] or l > k
where k = order, l is equal to the integers from
(k + 1)/2 to k.
This formula is given in Scott, W<c3><bc>rtz and Tran (2008,
working paper).
The function also calculates M which is equal to 2l - k.
It is a common term which will appear in the formulae
for calculating moments of generalized hyperbolic and related distributions.
Value
a
The non-zero moment coefficients for the specified order.
l
Integers from (order+1)/2 to order. It is used when
computing the moment coefficients and the mu moments.
M
The common term used when computing mu moments for generalized
hyperbolic and related distributions, M = 2l - k,
k=order
Scott, D. J., W<c3><bc>rtz, D. and Tran, T. T. (2008)
Moments of the Generalized Hyperbolic Distribution. Preprint.
Examples
momRecursion(order = 12)
#print out the matrix
momRecursion(order = 12, "true")
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/momRecursion.Rd_%03d_medium.png", width=480, height=480)
> ### Name: momRecursion
> ### Title: Computes the moment coefficients recursively for generalized
> ### hyperbolic and related distributions
> ### Aliases: momRecursion
> ### Keywords: distribution
>
> ### ** Examples
>
> momRecursion(order = 12)
$a
l = 6 l = 7 l = 8 l = 9 l = 10 l = 11 l = 12
10395 62370 51975 13860 1485 66 1
$L
[1] 6 7 8 9 10 11 12
$M
[1] 0 2 4 6 8 10 12
$lmin
[1] 6
>
> #print out the matrix
> momRecursion(order = 12, "true")
l = 1 l = 2 l = 3 l = 4 l = 5 l = 6 l = 7 l = 8 l = 9 l = 10 l = 11
order = 1 1 0 0 0 0 0 0 0 0 0 0
order = 2 1 1 0 0 0 0 0 0 0 0 0
order = 3 0 3 1 0 0 0 0 0 0 0 0
order = 4 0 3 6 1 0 0 0 0 0 0 0
order = 5 0 0 15 10 1 0 0 0 0 0 0
order = 6 0 0 15 45 15 1 0 0 0 0 0
order = 7 0 0 0 105 105 21 1 0 0 0 0
order = 8 0 0 0 105 420 210 28 1 0 0 0
order = 9 0 0 0 0 945 1260 378 36 1 0 0
order = 10 0 0 0 0 945 4725 3150 630 45 1 0
order = 11 0 0 0 0 0 10395 17325 6930 990 55 1
order = 12 0 0 0 0 0 10395 62370 51975 13860 1485 66
l = 12
order = 1 0
order = 2 0
order = 3 0
order = 4 0
order = 5 0
order = 6 0
order = 7 0
order = 8 0
order = 9 0
order = 10 0
order = 11 0
order = 12 1
$a
l = 6 l = 7 l = 8 l = 9 l = 10 l = 11 l = 12
10395 62370 51975 13860 1485 66 1
$L
[1] 6 7 8 9 10 11 12
$M
[1] 0 2 4 6 8 10 12
$lmin
[1] 6
>
>
>
>
>
> dev.off()
null device
1
>