Normal Random Number Generation | Statistical Distrubutions and R commands

normal-distribution
General R langauage Statistics1 Comment on Normal Random Number Generation | Statistical Distrubutions and R commands

Normal Random Number Generation | Statistical Distrubutions and R commands

The statistical approach to random numbers is very particular. In gambling and games of chance, random numbers have the main role. So, in a sequence of posts in Armancomputer magazine, I will discuss probability distribution and introduce some commands in R language, to generate random numbers from the main statistical distributions such as Normal, Uniform, t-student, and chi-square.


Random Number Generation and Statistical Distribution

In probability Theory, we compute probability based on the sample space and event set. As a rule, the probability of an event is its size (as a set) divided by the sample set size. However, this definition has some limitations.

  • If sample space is not countable, how is probability computed.
  • If the event is not countable, how is probability computed.

And some many questions about real-world probability and random phenomena.

  • is there any rule for computing probability in the real world?
  • is there any pattern to see an event for the random phenomenon.

These problems, lead the scientists to a new approach to probability and its rules.

Statistical distributions and Random numbers

Many real random phenomena have a pattern of occurrence. This rule is named the Probability distribution. However using some translations, we convert a set function of probability (measure theory) to a real function to recognize these patterns or distributions. So, the set theory is converted to real function problems in probability and statistical theory.

Normal Distribution

If you come across a random phenomenon its outcome is real numbers, it may fit by Normal Distribution. The normal distribution is identified by the below plot.

Normal Distibution
Normal Distribution

The plots show that there are two parameters for normal distribution.  Mean as shown by $\mu$ and variance $\sigma^2$. The rnorm command in R may generate random numbers from a normal distribution. As it is clear, rnorm has three parameters.

The first parameter (n) shows how many random numbers may be generated. The second and third parameters are normal distribution characteristics. Mean and Standard deviation (square root of variance). The R language code below shows how to generate normal random numbers and visualize their distribution.

The probability distribution graph is plotted as follows:

normal density plot
normal density plot

PS: If using the ggplot2 library, your command may be as follows:

In the next post, I will describe how to compare two normal distributions through their plots.    

Loading

One thought on “Normal Random Number Generation | Statistical Distrubutions and R commands

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top