An R Introduction to Statistics

Continuous Uniform Distribution

The continuous uniform distribution is the probability distribution of random number selection from the continuous interval between a and b. Its density function is defined by the following.

       {
         b−1a   when  a ≤ x ≤ b
f(x) =  0      when  x < a or x > b

Here is a graph of the continuous uniform distribution with a = 1, b = 3.

PIC

Problem

Select ten random numbers between one and three.

Solution

We apply the generation function runif of the uniform distribution to generate ten random numbers between one and three.

> runif(10, min=1, max=3) 
[1] 1.6121 1.2028 1.9306 2.4233 1.6874 1.1502 2.7068 
[8] 1.4455 2.4122 2.2171