Questions tagged [scipy.stats]
297 questions
0
votes
1 answer
Scipy Integration to calculate E(X) of distributions available in scipy stats
Hi can anybody help me with fixing this code, thanks in advance
from scipy.integrate import quad
import math
import numpy as np
from scipy import stats
lognorm_mu = 17.79
lognorm_sigma = 0.81
def integrand(x):
return stats.lognorm.pdf(x, s=…

syys
- 63
- 7
0
votes
1 answer
Using SciPy to Fit a Levy-Stable Distribution with positive vs negative skew
I don't understand the parameters returned by the _fitstart() method of scipy.stats.levy_stable for distributions with positive versus negative beta parameters. Intuitively, changing the sign of beta when generating a random sample should not…

TMBailey
- 557
- 3
- 14
0
votes
1 answer
How to "mle_tuple" returned by "scipy.stats.rv_continuous.fit" to sample from a distribution(python/scipy)
I have gotten a result from fitting my data using(scipy.stats.rv_continuous.fit):
'exponweib': (10.92, 0.64,-0.91,2.816)
'genextreme': (-0.194, 10.92, 7.01),
'beta': (0.72,65.760,1.01999,862.270)
I want to sample from each distribution after…

Maya SI
- 1
0
votes
1 answer
Differences in frequency count: Stats.relfreq vs Seaborn
I'm using Seaborn to plot a relative frequency histogram. Since I havn't found a way to save value associated with the highest peak I used stats.relfreq to do this. However relative frequency does not seem to be matching.
I am using Python in…

OLGJ
- 331
- 1
- 7
0
votes
1 answer
Best fit to a histogramplot Iris
I want to plot the best fit line to every Iris class per feature histogram plot.
I have tried the solutions from these examples: 1 and 2, but dont get the result i want.
This is how the histogram looks like now, and how I want them to look, but with…

vegiv
- 124
- 1
- 9
0
votes
1 answer
Formula for partial expectation in scipy lognorm
I have just been trying to match the scipy outputs of the lognormal distribution to the formulas on wikipedia.
And I am stuck on the partial expectation with a lower bound.
If I use this simple lognormal distribution:
k = .25
sigma = .5
mu = .1 #…

Ryan Skene
- 864
- 1
- 12
- 29
0
votes
1 answer
scipy.stats rankdata : error "rankdata() got an unexpected keyword argument 'axis'"
I am getting an error utilizing rankdata from scipy.stats. Not sure where the issue is and how I can solve it. Would appreciate the help! (I am adding some code prior for the reference)
with model:
…

vethraut
- 35
- 5
0
votes
1 answer
Run spicy.stats ANOVA test for all unique values in a data frames column?
I have a data frame which consist of many cities and their corresponding temperature:
CurrentThermostatTemp
City
Cradley Heath 20.0
Cradley Heath 20.0
Cradley Heath …

GUILLE DOMINGUEZ
- 9
- 3
0
votes
1 answer
Scipy confidence interval returns different bounds than manual calculation
I have the following data from 10 different people.
df = pd.DataFrame({'id':range(1, 11),
'x':[.7,-1.6,-.2,-1.2,-.1,3.4,3.7,.8,0,2]})
print(df)
id x
0 1 0.7
1 2 -1.6
2 3 -0.2
3 4 -1.2
4 5 -0.1
5 6 3.4
6 7 …

Arturo Sbr
- 5,567
- 4
- 38
- 76
0
votes
0 answers
How to calculate efficient minimum distance in Python (regression)
I was wondering if it was possible to calculate the efficient minimum distance estimator b_emd in Python using statsmodels or scipy or such packages. I know its possible to do by hand just with matrix multiplication but I wanted to know if there was…

stressed
- 328
- 2
- 7
0
votes
1 answer
Binomial SciPy Syntax
I am trying to understand SciPy Binomial, I am making no headway with the scipy manual.
I can simulate a coin flip with NumPy random.
import numpy as np
print('Simulating the result of a single fair coin flip ')
n = 1
p = 0.5
result =…

Christopher
- 427
- 1
- 8
- 18
0
votes
0 answers
Scipy: randomly sample from two distributions but with one value always greater than the other
I have two overlapping gamma distributions, 'a' and 'b', which are correlated but with correlation coefficient < 1. I want to randomly sample pairs of values, one from each distribution.
However, there is a physical relation between all sampled…

henrybish
- 3
- 3
0
votes
0 answers
scipy.stats numpy.core._exceptions._UFuncBinaryResolutionError: ufunc 'add' cannot use operands with types dtype('
I am willing to calculate trend of a netcdf file using scipy.stats. Everytime I run this code snippet:
import scipy.stats
slope0 = np.zeros(GDI[0, :, :].shape)
intercept0 = np.zeros(GDI[0, :, :].shape)
r_value0 = …

Stephny
- 1
- 1
0
votes
1 answer
SciPy stats lognormal distribution obtain pdf with given lognormal distribution mean and lognormal distribution geometric standard deviation
I am working with droplets distribution, for purpose of my work I would like to create droplet distribution plot. In this case I need lognorm.pdf for scipy. Unfortunately scipy build function lognorm.pdf has an equation like this:
lognorm.pdf(x, s)…

Fihu
- 3
- 3
0
votes
1 answer
Multivariate KDE Scipy Stats - what if it's not Gaussian?
I have some 2D data that I am smoothing using:
from scipy.stats import gaussian_kde
kde = gaussian_kde(data)
but what if my data isn't Gaussian/tophat/the other options? Mine looks more elliptical before smoothing, so should I really have a…

Lizardinablizzard
- 55
- 9