Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inverse of scipy.stats.lognorm.interval

from scipy.stats import lognorm
posterior_fb = lognorm(s=np.log(1.14), scale=0.007)
intervals = post_fb.interval(0.99)

post_fb.interval(0.99) gives me the endpoints of the range that contains 99% of the distribution, i.e., (0.0049, 0.0098)

I need a function that does the inverse. That is you can specify the two points, and the function will calculate the percentage of the distribution that lies within those two points.

For example, inverse_of_interval(0.0049, 0.0098) would give me 0.99.

like image 982
DPdl Avatar asked Dec 07 '25 06:12

DPdl


1 Answers

You can try to use the cdf of the lognorm:

 post_fb = lognorm(s=np.log(1.14), scale=0.007)
 post_fb.cdf(0.0098) - post_fb.cdf(0.0049)
like image 138
Robin Nicole Avatar answered Dec 09 '25 21:12

Robin Nicole



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!