rnorm function

This function generates a vector of normally distributed random variables given a vector length n, a population mean μ and population standard deviation σ. 

Syntax: rnorm(n, mean, sd) 

Parameters:

  • n: number of datasets to be simulated
  • mean: vector of means.
  • sd: vector standard deviation.

Example: In this example, with the use of the rnorm() function we are generating a vector of 10 normally distributed random variables with mean=10 and sd=2.

R




rnorm(10, mean = 10, sd = 2)


Output:

 [1] 10.886837  9.678975 12.668778 10.391915  7.021026 10.697684  9.340888  6.896892 12.067081 11.049609



A Guide to dnorm, pnorm, rnorm, and qnorm in R

In this article, we will be looking at a guide to the dnorm, pnorm, qnorm, and rnorm methods of the normal distribution in the R programming language.

Similar Reads

dnorm function

This function returns the value of the probability density function (pdf) of the normal distribution given a certain random variable x, a population mean μ, and the population standard deviation σ....

pnorm function

...

qnorm function

This function returns the value of the cumulative density function (cdf) of the normal distribution given a certain random variable q, a population mean μ, and the population standard deviation σ....

rnorm function

...

Contact Us