Scipy - Stats - Parameter value for probability distributions

Scipy docs gives a distribution form used exponentially like:

expon.pdf(x) = lambda * exp(- lambda*x) 

However, the matching function accepts:

 fit(data, loc=0, scale=1) 

And the rvs function accepts:

 rvs(loc=0, scale=1, size=1) 

Question 1: Why an extraneous location variable? I know that exhibitors are only concrete forms of a more general distribution (gamma), but why do they include raw information? Even gamma does not have a location parameter.

Question 2: Is the output a room (...) in the same order as the input variable. By this I mean If I do this:

 t = fit([....]) , t will have the form t[0], t[1] 

Should I interpret t [0] as a form and t 1 as a scale.

Is this supported for all distributions?

How about gamma:

 fit(data, a, loc=0, scale=1) 
+6
source share
1 answer
  • Each one-dimensional probability distribution, regardless of its usual wording, can be expanded to include a location and scale parameter. Sometimes this leads to the fact that distribution support extends only from positive / non-negative numbers to the entire valid numeric string with only a PDF value of 0 for loc . scipy.stats does this to move all loc and scale processing to the common method used by all distributions. It has been proposed to remove this and make distributions such as gamma loc in order to follow their canonical formulations. However, it turns out that some people do use “shifted gamma distributions” with nonzero loc parameters to model the size of sunspots, if I remember correctly, and the current behavior of scipy.stats was ideal for them. Therefore, we keep it.

  • The output of the fit() method is a tuple of the form (shape0, shape1, ..., shapeN, loc, scale) , if there are parameters of the form N For a normal distribution that has no shape parameters, it will only return (loc, scale) . For a gamma distribution that has one, it will return (shape, loc, scale) . Multiple form parameters will be in the same order that you give each other distribution method. This applies to all distributions.

+4
source

Source: https://habr.com/ru/post/950096/


All Articles