Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the loc and scale parameters in scipy.stats.maxwell?

The maxwell-boltzmann distribution is given by maxwell-boltzmann
(from MathWorld - A Wolfram Web Resource: wolfram.com)
. The scipy.stats.maxwell distribution uses loc and scale parameters to define this distribution. How are the parameters in the two definitions connected? I also would appreciate if someone could tell in general how to determine the relation between parameters in scipy.stats and their usual definition.

like image 458
Yogesh Yadav Avatar asked Nov 15 '25 20:11

Yogesh Yadav


1 Answers

The loc parameter always shifts the x variable. In other words, it generalizes the distribution to allow shifting x=0 to x=loc. So that when loc is nonzero,

maxwell.pdf(x) = sqrt(2/pi)x**2 * exp(-x**2/2), for x > 0

becomes

maxwell.pdf(x, loc) = sqrt(2/pi)(x-loc)**2 * exp(-(x-loc)**2/2), for x > loc.

The doc string for scipy.stats.maxwell states:

A special case of a chi distribution, with df = 3, loc = 0.0, and given scale = a, where a is the parameter used in the Mathworld description.

So the scale corresponds to the parameter a in the equation


(from MathWorld - A Wolfram Web Resource: wolfram.com)

In general you need to read the distribution's doc string to know what parameters the distribution has. The beta distribution, for example, has a and b shape parameters in addition to loc and scale.

However, I believe for all continuous distributions, distribution.pdf(x, loc, scale) is identically equivalent to distribution.pdf(y) / scale with y = (x - loc) / scale.

like image 128
unutbu Avatar answered Nov 17 '25 10:11

unutbu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!