, . , , , , 1.
. x
-7,5 7,5, 0,1 0 2,5 x
.
x <- seq(from = -7.5, to = 7.55, by = 0.1)
y <- dnorm(x, 0, 2.5)
, ( y
), (0,1), 1:
> sum(y * 0.1)
[1] 0.9974739
, , .
? , - , , , .
. , ( , 2,5) -7,5 4. .
:
library(ggplot2)
d <- data.frame(x, y)
ggplot(d, aes(x = x, y = y)) +
geom_line() +
geom_point() +
geom_ribbon(fill = "steelblue", aes(ymax = y), ymin = 0, alpha = 0.5, data = subset(d, x <= 4)) +
annotate("text", x= -4, y = 0.13, label = "Each point is an individual density\nestimate of dnorm(x, 0, 2.5)") +
annotate("text", x = -.3, y = 0.02, label = "Filled area under the curve shows the cumulative probability\nof getting a number as high as a given x, in this case 4") +
ggtitle("Density of a random normal variable with mean zero and standard deviation 2.5")