Did I find the right examples for you? yes no

sympy.stats.skewness

All Samples(12)  |  Call(9)  |  Derive(0)  |  Import(3)
Measure of the asymmetry of the probability distribution

Positive skew indicates that most of the values lie to the right of
the mean

skewness(X) = E( ((X - E(X))/sigma)**3 )

Examples
========
(more...)

def skewness(X, condition=None, **kwargs):
"""
Measure of the asymmetry of the probability distribution

Positive skew indicates that most of the values lie to the right of
the mean

skewness(X) = E( ((X - E(X))/sigma)**3 )

Examples
========

>>> from sympy.stats import skewness, Exponential, Normal
>>> from sympy import Symbol
>>> X = Normal('X', 0, 1)
>>> skewness(X)
0
>>> rate = Symbol('lambda', positive=True, real=True, bounded = True)
>>> Y = Exponential('Y', rate)
>>> skewness(Y)
2
"""
return smoment(X, 3, condition, **kwargs)

from sympy.stats import (P, E, where, density, variance, covariance, skewness,
given, pspace, cdf, ContinuousRV, sample,
Arcsin, Benini, Beta, BetaPrime, Cauchy,
Chi, ChiSquared,
ChiNoncentral, Dagum, Erlang, Exponential,
assert covariance(X, Y) == 0
assert covariance(2*X + Y, -X) == -2*variance(X)
assert skewness(X) == 0
assert skewness(X + Y) == 0
assert correlation(X, Y) == 0
assert cmoment(X, 2) == variance(X)
assert smoment(X*X, 2) == 1
assert smoment(X + Y, 3) == skewness(X + Y)
assert E(X, Eq(X + Y, 0)) == 0
assert variance(X, Eq(X + Y, 0)) == S.Half
assert E(X) == 1/rate
assert variance(X) == 1/rate**2
assert skewness(X) == 2
assert skewness(X) == smoment(X, 3)
assert smoment(2*X, 4) == smoment(X, 4)

from sympy import (EmptySet, FiniteSet, S, Symbol, Interval, exp, erf, sqrt,
symbols, simplify, Eq, cos, And, Tuple, Or, Dict, sympify, binomial,
factor)
from sympy.stats import (DiscreteUniform, Die, Bernoulli, Coin, Binomial,
Hypergeometric, P, E, variance, covariance, skewness, sample, density,
assert correlation(X, Y) == 0
assert correlation(X, Y) == correlation(Y, X)
assert smoment(X + Y, 3) == skewness(X + Y)
assert smoment(X, 0) == 1
assert P(X > 3) == S.Half
assert Eq(variance(X), n*p*(1 - p))
if n > 0 and 0 < p < 1:
assert Eq(skewness(X), (1 - 2*p)/sqrt(n*p*(1 - p)))
for k in range(n + 1):
assert Eq(P(Eq(X, k)), binomial(n, k)*p**k*(1 - p)**(n - k))
assert simplify(E(X)) == n*p == simplify(moment(X, 1))
assert simplify(variance(X)) == n*p*(1 - p) == simplify(cmoment(X, 2))
assert factor(simplify(skewness(X))) == factor((1-2*p)/sqrt(n*p*(1-p)))

# Test ability to change success/failure winnings
# Only test for skewness when defined
if N > 2 and 0 < m < N and n < N:
assert Eq(skewness(X), simplify((N - 2*m)*sqrt(N - 1)*(N - 2*n)
/ (sqrt(n*m*(N - m)*(N - n))*(N - 2))))