Questions tagged [scipy.stats]
297 questions
0
votes
1 answer
Fitting a dataset to a mix of normal distributions
In my application, the input dataset often comes from a Gaussian distribution. But, sometimes it is multimodal, and in those cases, I would like to model the data as a mix of data from multiple Gaussian distributions.
Now, I want to arrive at an…

Suresh
- 925
- 1
- 9
- 23
0
votes
1 answer
How to create a linear fractional distribution as a custom discrete probability distribution?
I defined the following custom probability distribution:
import scipy.stats as st
# parameters
a = 3 / 16
b = 1
class linear_fractional(st.rv_discrete):
def _pdf(self, n):
if (n == 0):
return (a + b - 1) / (a + b)
…

MMM
- 373
- 1
- 4
- 12
0
votes
1 answer
Logistic model summary
this function produces an error
my code:
import numpy as np
import pandas as pd
import statsmodels.api as sm
df = pd.read_csv('./fraud_dataset.csv')
df[['weekday','weekend']]=…

Abdulrahman
- 11
- 1
0
votes
1 answer
How can I get the ".describe()" statistics over all numerical columns, nested or not?
What is the best method to get the simple descriptive statistics of any column in a dataframe (or list or array), be it nested or not, a sort of advanced df.describe() that also includes nested structures with numerical values.
In my case, I have a…

questionto42
- 7,175
- 4
- 57
- 90
0
votes
1 answer
Python scipy.stats - Get number for a specific probability at invweibull curve
I'm developing a system in Python that returns a specific number given a needed probability in a statistic curve
My dataset contains each value of this variable that I call "data".
First I get this values and show the histogram of it
import pandas…

Flavio Amadio
- 35
- 1
- 6
0
votes
0 answers
How works the function norm.pdf
I can't understand what parameters are used by the method norm.pdf().
From the documentation I have find this definition; https://kite.com/python/docs/scipy.stats.norm.pdf
But in this code for example the function is used in this way;
import numpy…

Andrea
- 39
- 8
0
votes
1 answer
How to use stats.norm in python for solving the question below relevant to probability distribution
I faced this question in ML book which really is more like a math question than ML. Would be grateful if you could give me a solution with stat or any packages bound to python
As per a survey on use of pesticides among 1000 farmers in grape farming…

Ali Esfandiari
- 47
- 4
0
votes
1 answer
Understanding the relationship between lognormal and normal distribution using scipy.stats and numpy
I'd be very grateful if someone could help me understand where I'm going wrong. I have some data describing probability distributions. The data provides me with values for P10, P50 and P90. I also know that the distribution is lognormal.
I've…

Tethian
- 1
0
votes
0 answers
How to optimize my function for numeric optimization?
The code below provides a complete reproducible example. My question is (mainly) on my function thetaMax(). This is a function which minimizes a log-likelihood of a psychometric process.
I am learning Python and doing so by translating my R…

user350540
- 429
- 5
- 17
0
votes
1 answer
One-sample Cramer-VonMises test with unknown parameters in python
I am looking for a one-sample Cramer-Von Mises test for a normal distribution with unknown parameters in python.
I found some discussion here
https://github.com/chrisb83/scipy/commit/9274d22fc1ca7ce40596b01322be84c81352899d
but this does not seem…

pyguy
- 99
- 1
- 6
0
votes
1 answer
displot for a specific histogram (not normal)
I am trying to overlay a truncated normal distribution with specific a and b parameters over a histogram of samples generated from the very same distribution.
How do I fit with a pdf of truncnorm(a,b)?
import numpy as np
import matplotlib.pyplot as…

RG S
- 33
- 3
0
votes
0 answers
Distribution fitting of Multiple columns
I am trying to get the distribution fitting of my data using scipy.stats. The data contains multiple columns col_1, col_2, col_3 in a single CSV file.
The problem is distribution fitting only takes a single column to identify a best distribution…

Case Msee
- 405
- 5
- 17
0
votes
1 answer
Power law distribution fitting in Python
I am using different python to fit density functions on a dataset. This data set is made of positive time values starting from 1 second.
I tested different density functions from scipy.statistics and the powerlaw library, as well as my own functions…

rhcpps
- 31
- 1
- 5
0
votes
2 answers
Simulate stock price based on a given equation in Python
How can I generate a price time series using the following equation:
p(t) = p0(1+A * sin(ωt +0.5η(t)))
where t ranges from 0 to 1 in 1000 time steps, p0 = 100, A = 0.1, and ω = 100. η(t) is a sequence of i.i.d Gaussian random variables with zero…

ah bon
- 9,293
- 12
- 65
- 148
0
votes
1 answer
Scipy Normaltest with multi-columns dataset
I have a dataset with 100 rows and 21 columns where columns are the variables. I want to know if these variables came from a multivariate normal distribution.
Thus, I've used de Normaltest from Scipy library but I can't understand the results. Here…

Jimena
- 3
- 4