Volume 9, Issue 4 Articles Tricks of the Trade In and Out Trott's Corner New Products New Publications Calendar News Bulletins New Resources Classifieds Download This Issue Editorial Policy Staff and Contributors Submissions Subscriptions Advertising Back Issues Contact Information 
MomentBased Density Approximants
AppendixThis appendix contains the Mathematica code that was used in connection with each of the seven examples. All the calculations are carried out with rational numbers so as to prevent any loss of precision. It would be advisable to quit the kernel between examples. Code for Example 1The end points of the support of the random variable are and . The degree of the polynomial approximation is . In this example, the random variable of interest is , which will be denoted by to conform to the general notation utilised in Section 4. Its th moment is given by whereas the th moment of defined on the interval is denoted by . The exact density function is denoted by and the approximate density functions obtained from equations (13) and (15) are given by and , respectively. The exact and approximate cumulative distribution functions obtained by integration are denoted by and , respectively.
Code for Example 2The end points of the support of the random variable are and . The degree of the polynomial approximation is . For a given sequence of moments, , , the approximate density,, is obtained from equation (14) in this case.
Code for Example 3The th moment of the standard lognormal distribution whose support is the positive halfline is . The exact and approximate density functions are respectively given by and , the latter being obtained from equation (28). denotes the distribution function corresponding to .
Code for Example 4The th moment of the mixture of three shifted gamma random variables, which is denoted by , is obtained by differentiation of the momentgenerating function, . The degree of the polynomial approximation is . The exact and approximate density functions are respectively given by and , the latter being determined from equation (29).
Code for Example 5We use the notation introduced in Section 4. First, we approximate the density function of the random variable as defined in Section 2 by making use of equation (42) with , a modified Jacobi polynomial. To conform to the general notation used in Section 4, we will again replace with .
Identical density approximants denoted by and in the following code are obtained from Result 4.1 and equation (43), respectively.
Code for Example 6We use Result 4.1 to approximate the density of Wilks' likelihood ratio criterion, which will be denoted by to conform to the general notation utilised in Section 4. In this case, both and are defined on the interval . The transformation is included in the code so that it could be applied if needed. The symbol N being protected, it is replaced by in the following code.
Code for Example 7We use the notation introduced in Section 4. First, we approximate the density function of the Gaussian mixture with by making use of an alternate representation of equation (42) with , a modified Hermite polynomial. The function provides an approximant which is directly expressed in terms of the moments of .
The same density approximant is obtained from equation (32).


About Mathematica  Download Mathematica Player © Wolfram Media, Inc. All rights reserved. 