Site menu:




R functions for the tempered stable distribution

This page provides R functions for the tempered stable distribution [Ref 1] using the parametrisation and numerical methods described by [Ref 2]. These programs were mostly written by Karen Palmer.

The functions available are:

      dts(x, param)
      pts(x, param)
      qts(x, param, lower = 1/10000, upper = 10000)
      rts(n, param)

These provide, respectively, the probability density function, the cumulative distribution function, the quantile function and a random number generator. For the quantile function, lower and upper should be set to values below and above the true quantile; the default values will suffice in most examples.

The argument param is a vector of length 3, giving the mean, coefficient of variation, and further parameter alpha (0 < alpha < 1) of the distribution. For details on this parametrisation, see [Ref 2]. The gamma distribution is the limiting distribution as alpha tends to zero and alpha = 1/2 gives the inverse Gaussian distribution.

These functions rely on numerical inversion of the Laplace transform of the p.d.f. or c.d.f. of the tempered stable distribution, using the method described in [Ref 3]. Generally this gives very accurate results, except sometimes in the extreme tails of the distribution, where the rescaling method outlined in [Ref 4] can give substantially improved accuracy. For further discussion of accuracy and of alternative numerical approaches, see [Ref 2].

To use the software, you will need to download the file TSfunctions.r into a suitable directory on your computer. This contains the functions listed above and various supporting functions. You should not need to look at the R code in this file unless you want to see the details of what's going on. The file TSscript.r gives examples of usage.


References

[1] Hougaard, P. (1986). Survival models for heterogeneous populations derived from stable distributions. Biometrika, 73, 387-396.

[2] Palmer, K.J., Ridout, M.S. and Morgan, B.J.T. (2011) Kinetic models of guanidine hydrochloride-induced curing of the yeast [PSI+] prion. Journal of Theoretical Biology, 274, 1-11. [Journal link]

[3] Abate, J., Choudhury, G.L. and Whitt, W. (1999). An introduction to numerical transform inversion and its application to probability models. In Computational Probability (ed. W. Grassmann), pp. 257-323. Boston: Kluwer.

[4] Choudhury, G.L. and Whitt, W. (1997). Probabilistic scaling for the numerical inversion of nonprobability transforms. INFORMS Journal on Computing, 9, 175-184.