6.3.4. statsmodels.sandbox.distributions.extras

Various extensions to distributions

  • skew normal and skew t distribution by Azzalini, A. & Capitanio, A.

  • Gram-Charlier expansion distribution (using 4 moments),

  • distributions based on non-linear transformation - Transf_gen - ExpTransf_gen, LogTransf_gen - TransfTwo_gen

    (defines as examples: square, negative square and abs transformations)

    • this versions are without __new__
  • mnvormcdf, mvstdnormcdf : cdf, rectangular integral for multivariate normal distribution

TODO: * Where is Transf_gen for general monotonic transformation ? found and added it * write some docstrings, some parts I don’t remember * add Box-Cox transformation, parameterized ?

this is only partially cleaned, still includes test examples as functions

main changes * add transf_gen (2010-05-09) * added separate example and tests (2010-05-09) * collect transformation function into classes

6.3.4.1. Example

>>> logtg = Transf_gen(stats.t, np.exp, np.log,
                numargs = 1, a=0, name = 'lnnorm',
                longname = 'Exp transformed normal',
                extradoc = '
distribution of y = exp(x), with x standard normal'
                'precision for moment andstats is not very high, 2-3 decimals')
>>> logtg.cdf(5, 6)
0.92067704211191848
>>> stats.t.cdf(np.log(5), 6)
0.92067704211191848
>>> logtg.pdf(5, 6)
0.021798547904239293
>>> stats.t.pdf(np.log(5), 6)
0.10899273954837908
>>> stats.t.pdf(np.log(5), 6)/5.  #derivative
0.021798547909675815

Author: josef-pktd License: BSD

6.3.4.2. Functions

absfunc(x)
derivminus(x)
derivplus(x)
get_u_argskwargs(**kwargs)
identit(x)
inverse(x)
inverseminus(x)
inverseplus(x)
inversew(x)
inversew_inv(x)
iteritems(obj, **kwargs) replacement for six’s iteritems for Python2/3 compat
mc2mvsk(args) convert central moments to mean, variance, skew, kurtosis
mvnormcdf(upper, mu, cov[, lower]) multivariate normal cumulative distribution function
mvsk2mc(args) convert mean, variance, skew, kurtosis to central moments
mvstdnormcdf(lower, upper, corrcoef, **kwds) standardized multivariate normal cumulative distribution function
negsquarefunc(x)
pdf_moments(cnt) Return the Gaussian expanded pdf function given the list of central moments (first one is mean).
pdf_moments_st(cnt) Return the Gaussian expanded pdf function given the list of central moments (first one is mean).
pdf_mvsk(mvsk) Return the Gaussian expanded pdf function given the list of 1st, 2nd moment and skew and Fisher (excess) kurtosis.

6.3.4.3. Classes

ACSkewT_gen() univariate Skew-T distribution of Azzalini
ExpTransf_gen(kls, *args, **kwargs) Distribution based on log/exp transformation
LogTransf_gen(kls, *args, **kwargs) Distribution based on log/exp transformation
NormExpan_gen(args, **kwds) Gram-Charlier Expansion of Normal distribution
SkewNorm2_gen([momtype, a, b, xtol, ...]) univariate Skew-Normal distribution of Azzalini
SkewNorm_gen() univariate Skew-Normal distribution of Azzalini
SquareFunc class to hold quadratic function with inverse function and derivative
TransfTwo_gen(kls, func, funcinvplus, ...) Distribution based on a non-monotonic (u- or hump-shaped transformation)
Transf_gen(kls, func, funcinv, *args, **kwargs) a class for non-linear monotonic transformation of a continuous random variable