Questions tagged [scipy.stats]

297 questions
0
votes
1 answer

Skewed distribution for a given range

I need to generate a skewed distribution for a given range (eg: low= 1, high =10) and size = 100. stats.skewnorm can produce a skewed distribution, but it does not take in the parameter for lower and upper bound. Can someone please help me with…
S.D
  • 21
  • 6
0
votes
1 answer

How to calculate the radius of a circle so that 95 % of the dots are inside of it

I have measured 100 points and calculated the standard deviation in x and y-direction. I then plotted each of the 100 points in an graph and now do I want to encircle 95 % of these points. The idea was that I could use the standard deviation to…
A turtle
  • 3
  • 1
0
votes
2 answers

How to increase the steps of scipy.stats.randint?

I'm trying to generate a frozen discrete Uniform Distribution (like stats.randint(low, high)) but with steps higher than one, is there any way to do this with scipy ? I think it could be something close to hyperopt's hp.uniformint.
abdelgha4
  • 351
  • 1
  • 16
0
votes
0 answers

Slope returning NaN using scipy

Trying to calculate slope on SMA df.date = pd.to_datetime(df.date) df['date_ordinal'] = pd.to_datetime(df['date']).map(dt.toordinal) slope, intercept, r_value, p_value, std_err = stats.linregress(df['date_ordinal'], df['SMA']) df['slope'] =…
confused
  • 1
  • 2
0
votes
2 answers

VS Code python doesn't autocomplete scipy.stats

In scipyt.stats we have the variable binom Somehow autocomplete in vscode doesn't seem to find it. In pycharm the autocomplete works fine. Any pointers as though why it is so ? Also just some sample code with binom as follows from scipy.stats import…
0
votes
2 answers

How to get ranks by sorting a list in descending order using scipy.stats.rankdata?

Having a list of numbers such as [968, 233, 493, 5, 851, 224, 871, 396, 689, 862] I would like to get a rank of each of them, where the highest number gets the lowest rank. By using scipy.stats.rankdata I get this array([10., 3., 5., 1., 7., …
0
votes
2 answers

lognormal fitting with scipy

import scipy.stats as st samp=st.lognorm(0.6,loc=2,scale=1).rvs(size=2000) # sample param=st.lognorm.fit(samp, floc = 0) # fit the sample data print(param) # does not coincide with shape, loc, scale above! x=np.linspace(0,10,100) pdf_fitted =…
rrkk
  • 437
  • 1
  • 5
  • 15
0
votes
0 answers

How to find third standard deviation of a half-norm shaped distribution in python or R?

I have a data frame: import pandas as pd import matplotlib.pyplot as plt df = pd.DataFrame([100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 5, 1, 0.9, 0.07, 0.001, 0.00001], columns=['Frequency']) I assume this data follows a half norm…
khemedi
  • 774
  • 3
  • 9
  • 19
0
votes
0 answers

What does the scipy.stats.t.fit() method return?

I have a set of data points sampled from a normal distribution. mu, sigma = 0, 1 x = rng.normal(mu, sigma, 100) I add outliers to the initial set outliers = np.random.uniform(low=6, high=7, size=10) # Concatenate original samples with outliers x…
0
votes
1 answer

Calculation performance scipy weibull min fit vs Matlab wblfit

Playing around with fitting data to Weibull distributions, using Matlab wblrnd and wblfit functions, and Python scipy.stats.weibull_min.fit function, I found that Matlab outperforms Python by almost 2 orders of magnitude. I am looking for some help…
tobyvd
  • 110
  • 1
  • 9
0
votes
1 answer

How to find the variance of the sample mean, given the population mean, standard deviation and sample size

Problem Statement : Given a sample of size n = 60 taken from a continuous population distribution with mean 56 and standard deviation 25, find the variance of the sample mean. I tried the below code but as expected, there is no fixed answer. And my…
0
votes
1 answer

Adding methods to scipy.stats.rv_continuous, problems with rv_frozen

I would like to add a method to all of the distribution in scipy.stats.rv_continuous. The method would return the cumulative counts, ie the product of an extra parameter nu (the total counts), and the existing cdf function. I tried adding the new…
Mister Mak
  • 276
  • 1
  • 9
0
votes
1 answer

Implementing rv_continuous

I am trying to write a version of scipy.stats.truncnorm with easier-to-use parameters (true range, mu and sig), by implementing scipy.stats.rv_continuous. I provide code for _argcheck, _get_support, _pdf, and _rvs, but get the error _parse_args()…
Mister Mak
  • 276
  • 1
  • 9
0
votes
1 answer

'numpy.float64' object has no attribute 'ttest_ind'

I am trying to perform a t-test with the following. It worked initially. But, now, it is showing the following error, 'numpy.float64' object has no attribute 'ttest_ind' col=list(somecolumns) for i in col: x = np.array(data1[data1.LoanOnCard ==…
0
votes
1 answer

How to create a function to test normality of each variable

I am trying to build a function that iteratively returns i) JarqueBera test stat, ii) JarqueBera pvalue, iii) the slope, intercept and determination coeff of the probplot, and iv) the probplot itself. All is intended to be returned for a single…