Questions tagged [scipy.stats]
297 questions
0
votes
1 answer
Chi2 heat map for categorical data to test for MCAR: cannot unpack non-iterable rv_frozen object
I want to understand if my missing data is MCAR or not.
I have a data set like this, where 0 means the data is present and 1 means the data is missing:
a b c d e
0 1 0 0 0
0 0 0 0 0
0 0 0 0 0
0 1 0 0 0
0 0 0 0 0
I want to…

Slowat_Kela
- 1,377
- 2
- 22
- 60
0
votes
1 answer
Package Pingouin in colab
I tried to import 'pingouin' in Colab by using standart commands:
!pip install pingouin
import pingouin
and got this error:
ImportError: cannot import name 'studentized_range' from 'scipy.stats'…

omer
- 69
- 6
0
votes
1 answer
How to fix a parameter when fitting with optimize.curve_fit?
I would like to fix a parameter using optimize.curve_fit.
This is my code:
def sinefunction2(x, a, b, c, phi, omega):
return a+ b * np.sin(omega*x + phi) + c*(np.sin(omega*x + phi))**2
phi = how to fix?
x= scan_no
y= fwhm_r
p0=[0.05, 0.1, 0.01,…

Krystal
- 31
- 5
0
votes
1 answer
Pandas t-test using row as the arrays
I need to find a way to calculate a p-value for two sets of data, comparing each row in one DataFrame with the accompanying row in another DataFrame. For example, array1 would be the five items in row 300 (not including stdev and Ctrl average), and…

lcfields
- 83
- 6
0
votes
1 answer
How to test the compliance of the sample with the given distribution by the Chi-square criterion?
Programming language - Python
I generate a sample like this, using the Numpy library, the approximate size is 1 million.
uniformSample = UniformSample(1000000)
uniformSample.generate()
def generate(self, a=0.0, b=1.0):
self.left = a
…

Liker Of Programming
- 5
- 1
- 2
0
votes
0 answers
How to make the y-axis of a normal distribution reflect probability density
I am generating normal distributions from the mean and standard deviation of a dataset with this code:
sampledRow = dataset.sample() # Get random item from the dataset
x = np.linspace(-10, 10, 1000) # Create X axis -10 to 10
# Normal Distribution…

Paul
- 165
- 1
- 12
0
votes
1 answer
Chi-squared for determining people voting in each category
My dataset contains the following columns:
Voted? Political Category
1 Right
0 Left
1 Center
1 Right
1 Right
1 Right
I would need to see which category is mostly associated with…

LdM
- 674
- 7
- 23
0
votes
1 answer
TypeError: "'numpy.float64' object is not callable" when using scipy.stats.bootstrap
I would like to apply the statistical bootstrapping method with scipy.stats.bootstrap.
In my code below, I load two distinct .txt files into Python. Each file contains a single column of numeric values (floats). I would like to calculate the…

Philipp
- 335
- 2
- 4
- 12
0
votes
0 answers
Convert t-test summary to a dataframe in python?
I performed a t-test on my dataframe and want to access the p-values from the t-test results. Some have suggested to use .summary of the t-test results shown below:
cat1 = df[df['Drug']=='Drug A']
cat2 = df[df['Drug']=='Drug B']
results =…
user17304179
0
votes
1 answer
How to add text to a graph in python
I am trying to add text inside the below graph using figtext() but the written code below does not work. I appreciate any help.
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
x = np.array([0.00161, 0.00322, 0.00483,…

Nisa Aslan
- 37
- 4
0
votes
1 answer
Scipy.stats allows import of `norm` but not `norm_gen`
I want to import the "class factory" of the normal distribution in Scipy to tweak it but I get an import error when doing so:
In [5]: from scipy.stats import norm …

Learning is a mess
- 7,479
- 7
- 35
- 71
0
votes
0 answers
Fastest way to eleminate outlier in 2D array in python without pandas
I need to iterate over a lot of itemsets and need to remove the outlier. As a threshold, I simply use the standard val > 3* σ. Currently, I have the following solution:
def remove_outlier(data):
data_t = np.array(data).T.tolist()
for…

Lukas S
- 315
- 1
- 3
- 15
0
votes
0 answers
Using the inverse survival function of the negative binomial in SciPy
I want to use the python function scipy.stats.nbinom.isf(q, n, p) to calculate how many times i have to simulate in my Monte-Carlo simulation until i have 95% of successes. But I have some problems understanding the official documentation. What does…

lilchicken
- 1
- 2
0
votes
1 answer
How to round the confidence interval produced by the stats t interval to two decimal places
I am finding the t confidence interval across rows of my dataframe:
df = pd.DataFrame({'nums_1': [1, 2, 3], 'nums_2': [1, 1, 5], 'nums_3' : [8,7,9]})
df['CI']=df.apply(lambda row: stats.t.interval(0.95, len(df)-1,
loc=np.mean(row),…

Niam45
- 552
- 2
- 16
0
votes
1 answer
A problem with normalizing a function using scipy integrate module
I want to normalize a function (for example, chi2.pdf of scipy) over a range of A to B. For example, chi2.pdf is normalized for its range of 0 to infinity and it's integral over that area is 1. In order to do that, I can calculate integral of…

ivan199415
- 375
- 3
- 12