Tutorial Randomnumbers Excel

  • Upload
    gambodc

  • View
    218

  • Download
    0

Embed Size (px)

Citation preview

  • 7/28/2019 Tutorial Randomnumbers Excel

    1/5

    1

    Tutorial Random Number Generation in Excel

    Purpose: This tutorial shows you how to generate random number series in excelusing the data tool Data Analysis which comes as a standard add-on via the excel

    package Analysis ToolPak. There are two exercises in this tutorial.

    The first exercise walks you through generating random numbers from a normal

    distribution and then plotting a histogram of the numbers that you generated.

    The second exercise does more or less the same except that this time you generate the

    random numbers from a binomial distribution and then plot a histogram of the generated

    numbers.

    Exercise 1 (Random Numbers from a Normal Distribution)

    1. Creating a random series of Normal Distribution- Select Tool/Data Analysis/Random Number Generation

    - Then the Random Number Generation Box appears

    - On line Number of Variables, type 1 (We need only one series of normal

    distribution number, if you want 2 series, then type 2)- On line Number of Random Numbers, type 100 or any number that you wish

    for your random series- Click on line Distribution, then choose Normal

    - On line Mean, type 0 (or any number that you wish to be the mean of yourrandom series)

    - On line Standard Deviation, type 1 (or any number that you wish to be the

    standard deviation of your random series)

    - Click OK

    - The generated series has been sent to new worksheet

  • 7/28/2019 Tutorial Randomnumbers Excel

    2/5

    2

    2. Drawing the histogram of the generated random series of normal distribution

    - Move to the new worksheet that contains the random series- On the first cell of the column next to your random series, type

    =min(A1:A100)

    - On the next cell, type

    = max (A1:A100)- Based on the minimum and maximum of your generated series, creating bin

    - Lets say that your Min is -2.45316 and your Max is 2.769448. Then we will

    create Bin in the range -2 and 2 with 0.5 step between 2 consecutive bins.That is, type -2, -1.5,-1,-0.5,0,0.5,1,1.5,2 in the column next to your min and

    max column.

    -

    - Click on Tool/Data Analysis/Histogram

    - The Histogram box appears,

    . Click on the Input Range line, then highlight the area of your generated

    random series, say A1:A100. On the Bin Range, highlight the area of your bin, say C1:C9

    . Tick on box Pareto (sorted histogram), Cumulative Percentage, and Chart

    Output, then click Ok.- The output has been sent to a new worksheet

  • 7/28/2019 Tutorial Randomnumbers Excel

    3/5

    3

  • 7/28/2019 Tutorial Randomnumbers Excel

    4/5

    4

    Exercise 2 (Random Numbers from a Binomial Distribution)

    Assume that you are concerned with a problem of a workshop with 5 machines. The

    probability of a machine that does not working in one day is 0.1. You want to create a

    random series of the number of machine that does not working in 100 days. Obviously,the series follow the binominal distribution with n=5 and p=0.1.

    - Select Tool/Data Analysis/Random Number Generation

    - The Random Number Generation Box appear,

    . On the Number of Variables line, type 1

    . On the Number of Random Numbers, type 100 (mean 100 days)

    . On the Distribution line, choose Binominal

    . On the p-Value line, type 0.1 (since p=0.1)

    . On the Number of trials, type 5 (since there are 5 machines)

    .Click Ok

    - The generated series has been sent to a new worksheet

    Drawing the histogram of the generated binominal random series

  • 7/28/2019 Tutorial Randomnumbers Excel

    5/5

    5

    - First we have to create Bin. Since we are interested in the number of machine

    that does not working in one day, we should create Bin from 0 to 5 with a stepof 1 between 2 consecutive bin, that is our bin is 0, 1, 2, 3, 4, 5.

    - Type 0, 1, 2, 3, 4, 5 on the column next to the column contains your generated

    series

    - Select Tool/Data Analysis/Histogram and following what have been instructedin the section of drawing histogram for normal random series.