Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

standard deviation in rnorm() in r

Just wondering what sd=1:10 really means in rnorm function (never seen this before) u <- rnorm(mean = 0, sd = 1:10, n = 10). Is there any simple way to check each value of sd using r command?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If you pass a vector as sd, each value will be applied to each simulation until your n is reached, for example:

rnorm(mean = 0, sd = c(0,100000), n = 5)
 0.00 116963.06      0.00  25354.82      0.00

So the first value is from a normal distribution with mean = 0 and standard deviation = 0, the second value has a sd of 100.000, the third value has a sd of 0,…

In your example each value will be simulated from a normal distribution with a different sd, going from 1 to 10.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading