Dear R,
I am graphing the following normal density curve. Why does it look so
different?
# the curves
x <- seq(-2, 4, by=0.00001)
curve(dnorm(x, 2, 10^(-100)), -4, 4) #right answer
curve(dnorm(x, 2, 10^(-100)), -3, 4) #changed -4 to -3, I get wrong answer
Why the second curve is flat? I just changed it from -4 to -3. There is
no density in that region.
Also, I am doing numerical integration. Why are they so different?
> x <- seq(-2, 4, by=0.00001)
> sum(x*dnorm(x, 2, 10^(-100)))*0.00001
[1] 7.978846e+94
> x <- seq(-1, 4, by=0.00001) #changed -2 to -1
> sum(x*dnorm(x, 2, 10^(-100)))*0.00001
[1] 0
What is going here? What a I doing wrong?
Thanks so much!
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.