              Research Article

# Bayesian Analysis of Gamma Distributions using S-PLUS and R Softwares S.P. Ahmad, A. Ahmed and A.A. Khan

ABSTRACT

In this study, we presented Normal and Laplace’s methods of approximations for posterior density of gamma distribution. The numerical and graphical illustrations of posterior densities of the parameters of interest has been done in S-PLUS and R-Softwares.

 Services Related Articles in ASCI Similar Articles in this Journal Search in Google Scholar View Citation Report Citation Science Alert

 How to cite this article: S.P. Ahmad, A. Ahmed and A.A. Khan, 2011. Bayesian Analysis of Gamma Distributions using S-PLUS and R Softwares. Asian Journal of Mathematics & Statistics, 4: 224-233. DOI: 10.3923/ajms.2011.224.233 URL: https://scialert.net/abstract/?doi=ajms.2011.224.233

Received: March 04, 2011; Accepted: May 24, 2011; Published: August 10, 2011

INTRODUCTION

The gamma distribution is used as a life time model (Gupta and Groll, 1961), though not nearly as much as the Weibull distribution. It does fit a wide variety of lifetime data adequately, besides failure process models that lead to it. It also arises in some situations involving the exponential distribution. Inference for gamma model has been considered by Engelhardt and Bain (1978), Chao and Glaser (1978), Zaman et al. (2005), Jamali et al. (2006), Saat et al. (2008). Lawless (2003) and Kalbfleisch and Prentice (2002) have made significant contributions.

The gamma distribution has a pdf of the form: (1)

where, α>0 and k>0 are parameters; α is a scale parameter and k is sometimes called the index or shape parameter.

Also: This distribution like the Weibull includes the exponential as a special case (k = 1). The distribution with α = 1 is called the one parameter gamma distribution and has pdf: (2)

Bayesian Analysis is an important approach to Statistics, which formally seeks use of prior information and Bayes Theorem provides the formal basis for using this information.

In this approach, parameters are treated as random variables and data is treated fixed. Ghafoor et al. (2005) and Rahul et al. (2009) have discussed the applications of Bayesian methods.

ANALYSIS OF GAMMA DISTRIBUTION

Let y = (y1, y2,..., yn) be an iid sample from gamma distribution (1) and then likelihood is defined as: (3)

The log-likelihood is given by: (4)

where: are arithmetic and geometric means, respectively. Setting and rearranging slightly, we get the likelihood equations: (5)

where: is a di-gamma function. is termed as tri-gamma function. These functions can be approximated well as: and These values are required to implement Newton’s method of optimization. However, this method is difficult to implement as compared to a very close approximation discussed by Johnson and Kotz (1970). The maximum estimate of k can be approximated as: (6)

and (7)

where, If the value of s ranges from 0 to 0.55722, then value of is given by Eq. 6 and if it lies between 0.55722 and 17, then it is given by Eq. 7. Once is obtained, we can find from: For large values of k, we can use the approximation so that These estimates are essentially needed for starting iterations.

APPROXIMATION OF GAMMA DISTRIBUTION BASED ON POSTERIOR MODES

In many areas of application, simple models suffice for most practical purposes but there are occasions when the complexity of the scientific questions at issue and the data available to answer them warrant the development of more sophisticated models which depart from standard forms. For such models, approximations to the posterior distribution of model parameters are useful in their own right and as a starting point for more exact methods. We make use of Normal and Laplace’s methods of approximation as discussed by Rubin and Schenker (1987) and Tierney and Kadane (1986).

Let y1, y2,...,yn be an iid observations from a gamma distribution Eq. 1 and then the likelihood is given by: (8)

where, are arithmetic and geometric mean, respectively.

We define log-likelihood as: (9)

We take partial derivatives with respect to α and k. We follow the standard approach of Box and Tiao (1973), Gelman et al. (1995), we assume that a priori α and k are approximately independent, so that p (α, k)≅ p (α) p (k) where, p (α) and p (k) are priors for α and k. Using Bayes theorem, the posterior density p (α, k|y) is given by: (10)

The log-posterior is given by:  (11)

For a prior p (α, k) ≅ p (α) p (k) = 1, we have The posterior mode is obtained by maximizing Eq. 11 with respect to α and k. The score vector of log posterior is given by: and Hessian matrix of log posterior is: Posterior mode can be obtained from Newton-Raphson iteration scheme: (12)

Consequently, modal variance Σ can be obtained as: p (α, k|y) can be used for drawing inference about α and k simultaneously.

Using normal approximation, we can write directly a bivariate normal approximation of Eq. 10 as: Similarly, we can write Bayesian analog of likelihood ratio criterion as: Using Laplace’s approximation, we can write Eq. 10 as: The marginal Bayesian inference about α and k is to be based on marginal posterior densities of these parameters. Marginal posterior for α can be obtained after integrating out p (α, k |y) with respect to k, i.e., Similarly, marginal posterior of k can be obtained as: We can write normal approximation of marginal posterior p (α|y) as: Bayesian analog of likelihood ratio criterion can also be defined as a test criterion as: Laplace’s approximation of marginal posterior density p (α|y) can be given by: Similarly, p (k|y) can be approximated and results corresponding to normal and Laplace’s approximation can be written as: or equivalently,  NUMERICAL AND GRAPHICAL ILLUSTRATIONS

The numerical and graphical illustration of posterior densities of the parameters of interest conveys a very convincing and comprehensive picture of Bayesian data analysis. We have developed several programs using S-PLUS and R softwares for gamma distribution. These programmes illustrate the strength of Bayesian methods in various practical situations. Soil samples were collected from rice growing areas as well as from fruit orchards of Kashmir valley and were analyzed for some relevant parameters. In present study, we studied available Potassium in the soil of Kashmir valley. The posterior mode and standard errors of parameters α and k of gamma distribution are presented in Table 1 by using normal approximation under different types of priors. Graphical display of marginal of posterior densities for α and k by using Normal approximation under different priors are shown in Fig. 1a-f, whereas Laplace’s approximation for α and k are shown in Fig. 2a-f. Fig. 1 (a-f): Normal approximation to parameters alpha and k of gamma distribution using different priors in S-PLUS and R. Postreior density for potassiom with (a) prior = 1, (b) prior = 1/k, (c) prior = 1/(alpha *k), (d) prior = 1, (e) prior = 1/k, (f) prior = 1/(alpha *k)

 Table 1: Posterior mode and Posterior standard error of Gamma distribution with different priors  Fig. 2 (a-f): Laplace’s approximation to parameters alpha and k of gamma distribution using different priors in S-PLUS and R. Postreior density for potassiom with (a) prior = 1, (b) prior = 1/k, (c) prior = 1/(alpha *k), (d) prior =1 (e) prior =1/k and (f) prior =1/(alpha *k) Fig. 3 (a-c): Comparing normal and laplace's approximation of alpha of gamma distribution with different priors using S-PLUS and R. Postreior density for potassiom with (a) prior = 1, (b) prior 1/k and (c) prior = 1/(alpha *k) Fig. 4 (a-c): Comparing normal and laplace's approximation of k of gamma distribution with different priors using S-PLUS and R. Postreior density for potassiom with (a) prior = 1, (b) prior 1/k and (c) prior = 1/(alpha *k)

The comparison between Normal and Laplace’s methods of approximation for marginal of posterior densities for parameters α and k are shown in Fig. 3a-c and Fig. 4a-c, respectively. This graphical comparison shows that the two approximations are in close agreement.

REFERENCES
Box, G.E.P. and G. Tiao, 1973. Bayesian Inference in Statistical Analysis. Adison and Wesley, UK., pp: 608.

Chao, M. and R.E. Glaser, 1978. The exact distribution of bartlett's test statistic for homogeneity of variances with unequal sample sizes. J. Am. Stat. Assoc., 73: 422-426.
Direct Link  |

Engelhardt, M. and L.J. Bain, 1978. Prediction intervals for the Weibull process. Technometrics, 20: 167-169.
Direct Link  |

Gelman, A., J.B. Carlin, H.S. Stern and D.B. Rubin, 1995. Bayesian Data Analysis. 1st Edn., Chapman and Hall, London.

Ghafoor, A., F. Muhammad and I.A. Arshad, 2005. Bayesian regression with prior non-sample information on mash yield. J. Applied Sci., 5: 187-191.
CrossRef  |  Direct Link  |

Gupta, S.S. and P.A. Groll, 1961. Gamma distribution in acceptance sampling based on life tests. J. Am. Stat. Assoc., 56: 942-970.
Direct Link  |

Jamali, A.S., L.J. Lin and D. Yingzhuo, 2006. Effect of scale parameters in the performance of shewhart control chart with interpretation rules. J. Applied Sci., 6: 2676-2678.
CrossRef  |  Direct Link  |

Johnson, N.L. and S. Kotz, 1970. Continuous Univariate Distributions. Vol. 1, 2, Houghton Mifflin Harcourt, Boston.

Kalbfleisch, J.D. and R.L. Prentice, 2002. The Statistical Analysis of Failure Time Data. 2nd Edn., Wiley-Interscience, New York, ISBN: 047136357X.

Lawless, J.F., 2003. Statistical Models and Methods for Lifetime Data. Wiley-Interscience, UK.

Rahul, G.P. Singh and O.P. Singh, 2009. Population projection of Kerala using bayesian methodology. Asian J. Applied Sci., 2: 402-413.
CrossRef  |  Direct Link  |

Rubin, D.B. and N. Schenker, 1987. Logit-Based Interval Estimation for Binomial Data Using the Jeffrey's Prior. In: Sociological Methodologies, Clogg, C.O. (Ed.). American Sociological Association, Washington, DC., pp: 131-144.

Saat, N.Z.M., A.A. Jemain and S.H.A. Al-Mashoor, 2008. A comparison of weibull and gamma distribution in application of sleep apnea. Asian J. Math. Stat., 1: 132-138.
CrossRef  |  Direct Link  |

Tierney, L. and J.B. Kadane, 1986. Accurate approximations for posterior moments and marginal densities. J. Am. Stat. Assoc., 81: 82-86.
Direct Link  |

Zaman, M.R., M.K. Roy and N. Akhter, 2005. Chi-square mixture of gamma distribution. J. Applied Sci., 5: 1632-1635.
CrossRef  |  Direct Link  |   ©  2019 Science Alert. All Rights Reserved