# Simulating values from a known probability distribution

What does simulating values from a known probability distribution mean? For instance, what does it mean to say, simulate values from $\text{Unif}(0,1)$? Does is mean that we have to construct a random variable $X$ such that $X\sim\text{Unif}(0,1)$, and we have to repeat the experiment many times to note down the values $X$ takes?

"Simulating values from a known probability distribution" means to generate realizations from a probability distribution. If you're talking about a uniform(0,1), this would mean generating a random number that has the same probabilistic properties as a random number that has a uniform(0,1) distribution, namely that $P(X \leq x) = x$, for $x \in (0,1)$

Simulating multiple realizations (or "repeating the experiment", as you put it) is a way to explore the properties of a probability distribution. For example, in R, if you wanted to look at variability in what a histogram and QQ plot of a sample of 50 realizations from a standard normal distribution looks like, you could paste the code

x <- rnorm(50)
par(mfrow=c(2,1))
hist(x)
qqnorm(x)
qqline(x)


several times.

Similarly, you could so a simulation study to explore variation in a sample statistic. E.g. if you wanted to explore what kinds of values you could see from the maximum of 20 uniform(0,1) random variables, you could type

max( runif(20) )


many times. You could similarly replicate these experiments a large number of times (say, 10000) to get a good estimate of the distribution of that sample statistic.

• This is a very nicely written answer that should be helpful to new users like the OP. Jan 9 '17 at 6:30