R Normal DistributionIn random collections of data from independent sources, it is commonly seen that the distribution of data is normal. It means that if we plot a graph with the value of the variable in the horizontal axis and counting the values in the vertical axis, then we get a bell shape curve. The curve center represents the mean of the data set. In the graph, fifty percent of the value is located to the left of the mean. And the other fifty percent to the right of the graph. This is referred to as the normal distribution. R allows us to generate normal distribution by providing the following functions: These function can have the following parameters:
Let's start understanding how these functions are used with the help of the examples. dnorm():DensityThe dnorm() function of R calculates the height of the probability distribution at each point for a given mean and standard deviation. The probability density of the normal distribution is: Example Output: pnorm():Direct LookUpThe dnorm() function is also known as "Cumulative Distribution Function". This function calculates the probability of a normally distributed random numbers, which is less than the value of a given number. The cumulative distribution is as follows: f(x)=P(X≤x) Example Output: qnorm():Inverse LookUpThe qnorm() function takes the probability value as an input and calculates a number whose cumulative value matches with the probability value. The cumulative distribution function and the inverse cumulative distribution function are related by p=f(x) Example Output: rnorm():Random variatesThe rnorm() function is used for generating normally distributed random numbers. This function generates random numbers by taking the sample size as an input. Let's see an example in which we draw a histogram for showing the distribution of the generated numbers. Example Output:
Next TopicR Binomial Distribution
