Questions tagged [scipy.stats]
297 questions
0
votes
1 answer
Python Mahalanobis distance multidimensional z-score
I want a performance score, like a z-score, for two-dimensional data around a known fixed point. I think I want the Mahalanobis distance now, rather than z-scores in each direction. But I don't have two vectors, I have a 2 x N array of positions of…

Lizardinablizzard
- 55
- 9
0
votes
0 answers
Is there a Python function to make a kernel density estimation (KDE) over a CDF?
I have a simple CDF (cumulative distribution function) that I want to estimate using a KDE (kernel density estimation) in order to smooth out the 'steppy' nature of the CDF. The dataset is quite small (40 datapoints), so the steps are quite obvious…
0
votes
1 answer
Write a function that performs multiple student t-test for a list of DataFrames
I have this DataFrame:
print(TempvsDType)
CurrentThermostatTemp
DwellingType
Bungalow 0.0
Bungalow 22.0
Bungalow 22.0
Bungalow …

GUILLE DOMINGUEZ
- 9
- 3
0
votes
1 answer
Kurtosis remains constant over different shaped normal distributions?
I want to explore the normal distribution with the same mean, but
changing std.
I expect that the Kurtosis will change with the std,
but in my results the Kurtosis stays constant?
What is the issue here?
At first I generated some normal distribution…

Ormetrom2354
- 315
- 3
- 11
0
votes
0 answers
Fitting histogram to chi2 with unknown degrees of freedom
Please could someone verify that the first parameter in a scipy.stats.chi2.fit for some data is actually the number of degrees of freedom df? Here is an example of what I'm checking
x=np.random.rand(1000)
y=stats.chi2.pdf(x,df=1)
z=np.log10(y)
#…

MKF
- 105
- 7
0
votes
1 answer
Fitting custom distribution scipy.stats gives overflow
I am trying to fit a generalised error distribution to some data that I have. The form of the distribution is given as
I have tried the following implementation
import numpy as np
import scipy.stats as st
from scipy.special import gamma
class…

mch56
- 742
- 6
- 24
0
votes
1 answer
Scipy Compute Mann Whitney U along Multiple Slices
Given the following arrays:
import numpy as np
from scipy.stats import mannwhitneyu
s1 = np.array([[1,2,3,4,5,6,7,8,0,10],[10,9,8,7,6,5,4,3,2,1]])
s2 = np.array([[1,11,3,7,5,6,7,8,0,10],[10,9,8,7,6,15,4,13,2,1]])
I want to run the…

Dance Party
- 3,459
- 10
- 42
- 67
0
votes
1 answer
Looking for efficient way to get pearsonr between two pandas columns
I am trying to find a way to get the person correlation and p-value between two columns in a dataframe when a third column meets certain conditions.
df…

jhaeckl
- 1
- 1
0
votes
1 answer
How to find percentage of values within given range in python?
Problem statement - Variable X has a mean of 15 and a standard deviation of 2.
What is the minimum percentage of X values that lie between 8 and 17?
I know about 68-95-99.7 empirical rule. From Google I found that percentage of values within 1.5…

MVKXXX
- 193
- 1
- 2
- 11
0
votes
2 answers
equivalent of "ksdensity" MATLAB built-in function in Python
I need the python equivalent code for the below MATLAB code:
[f,xi] = ksdensity(data,'Support','positive','Function','cdf');
I find the below python code, but I don't know how I can provide its cdf. I appreciate it if you could guide me.
from scipy…

Mohammad
- 163
- 2
- 8
0
votes
0 answers
Finding probability of mean falling within a range - Python, matplotlib
I am new to matplotlib and statistics. Trying to learn through the below example and need some help in terms of understanding and solution.
I have added a bar chart image below. I have sample data for four years 1992, 1993, 1994, and 1995. I have…

Vikrant
- 36
- 2
0
votes
1 answer
ValueError Issue with implementation of plotting uniform distribution
so i am trying to plot a uniform distribution using scipy.stats, but am running into this error, to do with shape transformation, could someone please tell me why this is happening / how my code should look, thank you.
Full Code and traceback…
user12482885
0
votes
1 answer
Vectorized KL divergence calculation between all pairs of rows of a matrix
I would like to find out the KL divergence between all pairs of rows of a matrix. To explain, let's assume there is a matrix V of shape N x K. Now I want to create a matrix L of dimension N x N, where each element L[i,j] = KL(V[i,:],V[j,:]). So far…

Hirak Sarkar
- 479
- 1
- 4
- 18
0
votes
0 answers
Different methods to test normality result in different outputs for the same data
I have data set from the internet and I wanted to try different normal tests for different columns.
I find it funny, that different normality tests give me different results. Not just a couple of decimals different but COMPLETELY different…

Noob Programmer
- 698
- 2
- 6
- 22
0
votes
1 answer
Dynamically create scipy.stats distribution from methods of another class
I have created a class which represents a statistical simulation. One aspect of that is a distribution of p-values, and the class contains methods characterizing that distribution:
class Simulation:
...
def pdf_p(self, p):
...
…

A. Donda
- 8,381
- 2
- 20
- 49