Why don't scipy.stats.mstats.pearsonr results agree with scipy.stats.pearsonr?
Date : March 29 2020, 07:55 AM
hope this fix your issue This looks like a bug in scipy.stats.mstats.pearsonr. It appears that the values in x and y are expected to be paired by index, so if one is masked, the other should be ignored. That is, if x and y look like (using  for a masked value): x = [1, , 3, 4, 5]
y = [9, 8, , 6, 5]

Unexpected scipy.stats.uniform behaviour
Date : October 31 2020, 05:57 AM
wish helps you It's a bug: https://github.com/scipy/scipy/issues/2069A different workaround for your example is to give the size argument explicitly along with the arguments that you are already using. In [1]: import scipy.stats as ss
In [2]: x = ss.uniform.rvs(np.zeros(5), np.array([1,2,3,4,5]))
In [3]: x
Out[3]: array([ 0.23848443, 0.47696885, 0.71545328, 0.9539377 , 1.19242213])
In [4]: x/x[0]
Out[4]: array([ 1., 2., 3., 4., 5.])
In [18]: x = ss.uniform.rvs(np.zeros(5), np.array([1,2,3,4,5]), size=5)
In [19]: x
Out[19]: array([ 0.67638863, 1.2253443 , 0.0812362 , 3.87469514, 3.88145975])
In [20]: x/x[0]
Out[20]: array([ 1. , 1.81159802, 0.12010285, 5.72850428, 5.73850534])

scipy.stats.uniform.expect have a different value than manual calculation
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further If you look at the documentation for expect, ub and lb do not mean what you think they do. They are bounds on the integral, not parameters for the distribution. You actually want: scipy.stats.uniform(loc=0.2, scale=0.4).expect(lambda x: x**2)

What are the arguments for scipy.stats.uniform?
Tag : python , By : platformNomad
Date : March 29 2020, 07:55 AM
This might help you The first argument is the lower bound, and the second argument is the range of the distribution. So the example distribution in your question is uniform between 5 and 55. Quoting from the documentation linked in your question:

Produce an object similar to scipy.stats.uniform() that will allow the exclusion of a specified range
Tag : python , By : Fenix Drakken
Date : December 21 2020, 04:41 AM
should help you out Use rv_histogram for piecewise constant PDFs. The PDF can be zero in a range of values, too: In [1]: import numpy as np
In [2]: bins = np.array([0, 70, 80, 100])
In [3]: vals = np.array([1.0, 0.0, 1.0])
In [4]: vals = vals * (bins[1:]  bins[:1]) # normalize the PDF
In [5]: vals /= vals.sum()
In [6]: import scipy.stats as stats
In [7]: rv = stats.rv_histogram((vals, bins))
In [8]: sample = rv.rvs(size=10000)
In [9]: ((70 < sample) & (sample < 80)).any()
Out[9]: False

