You just need to drop the argument "w" to dnorm
in curve
:
w<-rnorm(1000) hist(w,col="red",freq=F,xlim=c(-5,5)) curve(dnorm,-5,5,add=T,col="blue")
To use something other than "unit Normal", you specify the arguments "mean" and "sd" (and remember to change the graph limits for hist
and curve
:
w<-rnorm(1000, mean=10, sd=2) hist(w, col="red", freq=F, xlim=10+c(-5,5)) curve( dnorm(x, mean=10,sd=2), 5, 15, add=T, col="blue")

42-
source share