How to draw a standard normal distribution in R

Stats Rookie picture Stats Rookie · May 11, 2012 · Viewed 155.8k times · Source

Possible Duplicate:
Making a standard normal distribution in R

Using R, draw a standard normal distribution. Label the mean and 3 standard deviations above and below the (10) mean. Include an informative title and labels on the x and y axes.

This is a homework problem. I'm not sure how to get going with the code. How should I get started?

Answer

user1317221_G picture user1317221_G · May 11, 2012

I am pretty sure this is a duplicate. Anyway, have a look at the following piece of code

x <- seq(5, 15, length=1000)
y <- dnorm(x, mean=10, sd=3)
plot(x, y, type="l", lwd=1)

I'm sure you can work the rest out yourself, for the title you might want to look for something called main= and y-axis labels are also up to you.

If you want to see more of the tails of the distribution, why don't you try playing with the seq(5, 15, ) section? Finally, if you want to know more about what dnorm is doing I suggest you look here