Fitting parameter b of the Gamma distribution from mean, 95% in Python
问题 This Mathematica function finds parameter b of the Gamma distribution, given mean and 95% values and scaled by the mean [Mu]; The two values bracket [Beta] makes it fast and there is a restriction for max pg95= 5.8[Mu]* gb[[Mu] , p95 ]. I need to translate this code into Python: gb[\[Mu]_, p95_] := Block[{p = Min[p95/\[Mu], 5.8]}, \[Mu] FindRoot[CDF[GammaDistribution[1/\[Beta], \[Beta]], p] - .95 == 0, {\[Beta], 1, If[p == 1, 1.1, p]}][[1, 2]]]; 回答1: Even if you cannot find exactly equivalent