Questions tagged [distribution]

This tag concerns statistical distributions, their implementations, and properties.

In scientific software for statistical computing and graphics, many common statistical distributions are supported. See the documentation from ?Distribution. Additionally, the CRAN task review for distributions lists numerous packages for addition features.

2821 questions
156
votes
10 answers

Fitting empirical distribution to theoretical ones with Scipy (Python)?

INTRODUCTION: I have a list of more than 30,000 integer values ranging from 0 to 47, inclusive, e.g.[0,0,0,0,..,1,1,1,1,...,2,2,2,2,...,47,47,47,...] sampled from some continuous distribution. The values in the list are not necessarily in order, but…
s_sherly
  • 1,937
  • 4
  • 17
  • 14
116
votes
18 answers

Generate random numbers following a normal distribution in C/C++

How can I easily generate random numbers following a normal distribution in C or C++? I don't want any use of Boost. I know that Knuth talks about this at length but I don't have his books at hand right now.
Damien
  • 1,303
  • 2
  • 10
  • 7
91
votes
2 answers

Two-sample Kolmogorov-Smirnov Test in Python Scipy

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 =…
Akavall
  • 68,050
  • 39
  • 179
  • 227
72
votes
19 answers

JavaScript Math.random Normal distribution (Gaussian bell curve)?

I want to know if the JavaScript function Math.random uses a normal (vs. uniform) distribution or not. If not, how can I get numbers which use a normal distribution? I haven't found a clear answer on the Internet, for an algorithm to create random…
Mangooxx
  • 963
  • 1
  • 9
  • 13
52
votes
7 answers

Cumulative Normal Distribution Function in C/C++

I was wondering if there were statistics functions built into math libraries that are part of the standard C++ libraries like cmath. If not, can you guys recommend a good stats library that would have a cumulative normal distribution function?…
Tyler Brock
  • 27,248
  • 15
  • 69
  • 76
48
votes
3 answers

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

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 =…
tmthydvnprt
  • 8,832
  • 7
  • 49
  • 66
44
votes
8 answers

Fitting a Weibull distribution using Scipy

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…
kungphil
  • 1,509
  • 2
  • 15
  • 26
38
votes
2 answers

Uniform distribution of truncated md5?

Can we say that a truncated md5 hash is still uniformly distributed? To avoid misinterpretations: I'm aware the chance of collisions is much greater the moment you start to hack off parts from the md5 result; my use-case is actually interested in…
pinkgothic
  • 5,736
  • 3
  • 42
  • 67
36
votes
5 answers

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

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…
O.rka
  • 24,289
  • 52
  • 152
  • 253
34
votes
1 answer

Plot with fewer markers than data points (or a better way to plot CDFs?) [matplotlib, or general plotting help]

I am plotting Cumulative Distribution Functions, with a large number of data points. I am plotting a few lines on the same plot, which are identified with markers as it will be printed in black and white. What I would like are markers evenly spaced…
James Broadhead
  • 1,728
  • 1
  • 14
  • 19
30
votes
5 answers

Fitting a gamma distribution with (python) Scipy

Can anyone help me out in fitting a gamma distribution in python? Well, I've got some data : X and Y coordinates, and I want to find the gamma parameters that fit this distribution... In the Scipy doc, it turns out that a fit method actually exists…
Archanimus
  • 301
  • 1
  • 3
  • 3
28
votes
3 answers

Vary range of uniform_int_distribution

So i have a Random object: typedef unsigned int uint32; class Random { public: Random() = default; Random(std::mt19937::result_type seed) : eng(seed) {} private: uint32 DrawNumber(); std::mt19937 eng{std::random_device{}()}; …
LordAro
  • 1,112
  • 3
  • 12
  • 31
24
votes
5 answers

random unit vector in multi-dimensional space

I'm working on a data mining algorithm where i want to pick a random direction from a particular point in the feature space. If I pick a random number for each of the n dimensions from [-1,1] and then normalize the vector to a length of 1 will I…
Matt
  • 1,463
  • 3
  • 15
  • 32
22
votes
2 answers

skew normal distribution in scipy

Does anyone know how to plot a skew normal distribution with scipy? I supose that stats.norm class can be used but I just can't figure out how. Furthermore, how can I estimate the parameters describing the skew normal distribution of a…
Ben2209
  • 895
  • 3
  • 10
  • 21
22
votes
3 answers

Where should I put tests when packaging python modules?

I have a module that sits in a namespace. Should tests and data the tests rely on go in the namespace or in the top level where setup.py…
Stephen Paulger
  • 4,793
  • 1
  • 20
  • 42
1
2 3
99 100