How does dnorm work?

I am very new to statistics and R. Perhaps this is a very trivial question, but I really don't understand how this works.

Suppose I use dnorm(5, 0, 2.5). What does it mean?

I saw some resources where they said that this function calculates the height of a point in the density curve.

Now I read again that the exact probability of a number is 0 in a continuous distribution. So my question is, can I find out the height or the probability of a certain value, then how come 0?

I know that I mixed up some concepts. But I can’t find where I am wrong. It will be great if you save your time so that I understand this. Thanks in advance.

+4
source share
1 answer

, . , , , , 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. .

enter image description here

:

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")
+6

Source: https://habr.com/ru/post/1692825/


All Articles