Questions tagged [normal-distribution]

The normal distribution is an assumption of many parametric statistical tests, and is typically associated with a Gaussian distribution, often with mean=0 and standard deviation=1. The "bell curve" is the visual, intuitive model for this distribution. Gaussian distributions are associated with the function: f(x) = [1/(σ√2π)] e^(-[(x-μ)^2]/(2σ^2 ))

In scientific software for statistical computing and graphics, we can use dnorm function to compute density of a normal distribution, rnorm function to generate random samples from a normal distribution, pnorm function to compute CDF of a normal distribution and qnorm function to compute quantiles of a normal distribution.

1121 questions
136
votes
9 answers

How to plot normal distribution?

Given a mean and a variance is there a simple function call which will plot a normal distribution?
user1220022
  • 8,300
  • 16
  • 38
  • 49
127
votes
12 answers

Random Gaussian Variables

Is there a class in the standard library of .NET that gives me the functionality to create random variables that follow Gaussian distribution?
Sebastian Müller
  • 5,071
  • 11
  • 49
  • 79
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
109
votes
16 answers

Converting a Uniform Distribution to a Normal Distribution

How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?
Terhorst
  • 1,861
  • 3
  • 15
  • 19
76
votes
3 answers

How to calculate the inverse of the normal cumulative distribution function in python?

How do I calculate the inverse of the cumulative distribution function (CDF) of the normal distribution in Python? Which library should I use? Possibly scipy?
Yueyoum
  • 2,205
  • 3
  • 18
  • 25
59
votes
8 answers

Seeing if data is normally distributed in R

Can someone please help me fill in the following function in R: #data is a single vector of decimal values normally.distributed <- function(data) { if(data is normal) return(TRUE) else return(NO) }
CodeGuy
  • 26,751
  • 71
  • 191
  • 310
58
votes
7 answers

Generating random numbers with normal distribution in Excel

I want to produce 100 random numbers with normal distribution (with µ=10, σ=7) and then draw a quantity diagram for these numbers. How can I produce random numbers with a specific distribution in Excel 2010? One more question: When I produce, for…
ha.M.ed
  • 845
  • 4
  • 11
  • 19
49
votes
2 answers

Java normal distribution

I'm trying to simulate the arrival of fans to a stadium. The system itself, I believe it won't be a problem, but, the arrival of the fans follows a normal distribution. My problem is: I have a certain time for the arrival like 100 minutes and 1000…
Henrique Gonçalves
  • 1,472
  • 3
  • 17
  • 27
38
votes
4 answers

How to get a normal distribution within a range in numpy?

In machine learning task. We should get a group of random w.r.t normal distribution with bound. We can get a normal distribution number with np.random.normal() but it does't offer any bound parameter. I want to know how to do that?
maple
  • 1,578
  • 2
  • 13
  • 24
36
votes
3 answers

Sample from multivariate normal/Gaussian distribution in C++

I've been hunting for a convenient way to sample from a multivariate normal distribution. Does anyone know of a readily available code snippet to do that? For matrices/vectors, I'd prefer to use Boost or Eigen or another phenomenal library I'm not…
JCooper
  • 5,957
  • 1
  • 20
  • 31
36
votes
6 answers

Random number within a range based on a normal distribution

I want to generate random numbers with a range (n to m, eg 100 to 150), but instead of purely random I want the results to be based on the normal distribution. By this I mean that in general I want the numbers "clustered" around 125. I've found this…
ConfusedAgain
  • 363
  • 1
  • 3
  • 4
32
votes
4 answers

What is the difference between random.normalvariate() and random.gauss() in python?

What is the difference between random.normalvariate() and random.gauss()? They take the same parameters and return the same value, performing essentially the same function. I understand from a previous answer that random.gauss() is not thread safe,…
richnis
  • 541
  • 5
  • 10
32
votes
4 answers

Perform a Shapiro-Wilk Normality Test

I want to perform a Shapiro-Wilk Normality Test test. My data is csv format. It looks like this: heisenberg HWWIchg 1 -15.60 2 -21.60 3 -19.50 4 -19.10 5 -20.90 6 -20.70 7 -19.30 8 -18.30 9 -15.10 However, when I…
maximus
  • 10,204
  • 25
  • 85
  • 124
29
votes
4 answers

Code to generate Gaussian (normally distributed) random numbers in Ruby

What is some code to generate normally distributed random numbers in ruby? (Note: I answered my own question, but I'll wait a few days before accepting to see if anyone has a better answer.) EDIT: Searching for this, I looked at all pages on SO…
Eponymous
  • 4,271
  • 3
  • 37
  • 40
24
votes
2 answers

How to use boost normal distribution classes?

I'm trying to use boost::normal_distribution in order to generate a normal distribution with mean 0 and sigma 1. The following code doesn't work as some values are over or beyond -1 and 1 (and shouldn't be). Could someont point out what I am doing…
davidag
  • 2,505
  • 3
  • 23
  • 40
1
2 3
74 75