With the help of sympy.stats.BetaNoncentral() method, we can get the continuous random variable which represents the Type I noncentral beta distribution.
Syntax : sympy.stats.BetaNoncentral() Where alpha and beta are real number which is greater than 0. lambda is greater than or equal to 0. Return : Return the random variable.
Example #1 : In this example we can see that by using sympy.stats.BetaNoncentral() method, we are able to get the continuous random variable represents the noncentral beta distribution by using this method.
Python3
# Import sympy and betanoncentral from sympy.stats import BetaNoncentral, density from sympy import Symbol, pprint alpha = Symbol("alpha", positive = True ) beta = Symbol("beta", positive = True ) lambda = Symbol(" lambda ", nonnegative = True ) z = Symbol("z") # Using sympy.stats.BetaNoncentral() method X = BetaNoncentral("x", alpha, beta, lambda ) gfg = density(X)(z) pprint(gfg, use_unicode = False ) |
Output :
oo _____ \ ` \ -lambda \ k ——- \ k + alpha – 1 /lambda\ beta – 1 2 ) z *|—–| *(1 – z) *e / \ 2 / / ———————————————— / B(k + alpha, beta)*k! /____, k = 0
Example #2 :
Python3
# Import sympy and betanoncentral from sympy.stats import BetaNoncentral, density from sympy import Symbol, pprint alpha = 4 beta = 5 lambda = 1 # Using sympy.stats.BetaNoncentral() method X = BetaNoncentral("x", alpha, beta, lambda ) gfg = density(X)( 2 ) pprint(gfg, use_unicode = False ) |
Output :
oo ____ \ ` \ -k k + 3 -1/2 \ 2 *2 *e / —————- / B(k + 4, 5)*k! /___, k = 0