distribution

How to use t.ppf()? which are the arguments?

How to use t.ppf()? which are the arguments? Question: I couldn’t understand how to properly use t.ppf, could someone please explain it to me? I have to use this information scipy.stats.t scipy.stats a mean of 100 a standard deviation of 0.39 N = 851 (851 samples) When I’m asked to calculate the (95%) margin of …

Total answers: 2

Calculte kurtosis and skewness using for loop

Calculte kurtosis and skewness using for loop Question: i’m trying to calculteskewness and kurtosis for different fields. I want to get in the end table with each field name. the kurtosis and the skewness. for that I have written the next code: for i in data_dis.columns: print(‘skewness’,i,’:’,i.skew()) print(‘Kurtosis’,i,’:’,i.kurtosis()) AttributeError: ‘str’ object has no attribute ‘skew’ …

Total answers: 2

Why does scipy.norm.pdf sometimes give PDF > 1? How to correct it?

Why does scipy.norm.pdf sometimes give PDF > 1? How to correct it? Question: Given mean and variance of a Gaussian (normal) random variable, I would like to compute its probability density function (PDF). I referred this post: Calculate probability in normal distribution given mean, std in Python, Also the scipy docs: scipy.stats.norm But when I …

Total answers: 3

What do all the distributions available in scipy.stats look like?

What do all the distributions available in scipy.stats look like? Question: Visualizing scipy.stats distributions A histogram can be made of the scipy.stats normal random variable to see what the distribution looks like. % matplotlib inline import pandas as pd import scipy.stats as stats d = stats.norm() rv = d.rvs(100000) pd.Series(rv).hist(bins=32, normed=True) What do the other …

Total answers: 2

How to find probability distribution and parameters for real data? (Python 3)

How to find probability distribution and parameters for real data? (Python 3) Question: I have a dataset from sklearn and I plotted the distribution of the load_diabetes.target data (i.e. the values of the regression that the load_diabetes.data are used to predict). I used this because it has the fewest number of variables/attributes of the regression …

Total answers: 6

Select one element from a list using python following the normal distribution

Select one element from a list using python following the normal distribution Question: I would like to select one element from a list using python following the normal distribution. I have a list, e.g., alist = [‘an’, ‘am’, ‘apple’, ‘cool’, ‘why’] For example, according to the probability density function (PDF) of normal distribution, the 3rd …

Total answers: 2

Calculate Scipy LOGNORM.CDF() and get the same answer as MS Excel LOGNORM.DIST

Calculate Scipy LOGNORM.CDF() and get the same answer as MS Excel LOGNORM.DIST Question: I am reproducing a chart in a paper using the LOGNORM.DIST in Microsoft Excel 2013 and would like to get the same chart in Python. I am getting the correct answer in excel, but not in python. In excel the I have, …

Total answers: 2

Fitting a Weibull distribution using Scipy

Fitting a Weibull distribution using Scipy Question: I am trying to recreate maximum likelihood distribution fitting, I can already do this in Matlab and R, but now I want to use scipy. In particular, I would like to estimate the Weibull distribution parameters for my data set. I have tried this: import scipy.stats as s …

Total answers: 8

Two-sample Kolmogorov-Smirnov Test in Python Scipy

Two-sample Kolmogorov-Smirnov Test in Python Scipy Question: I can’t figure out how to do a Two-sample KS test in Scipy. After reading the documentation scipy kstest I can see how to test where a distribution is identical to standard normal distribution from scipy.stats import kstest import numpy as np x = np.random.normal(0,1,1000) test_stat = kstest(x, …

Total answers: 2