0

I have a random serie of values, a <- runif(1000, 0, 10), and a single value: b <- 1.5 . I want to plot the ecdf, and put on it the value to see the probability to have it.

But when i do that:

plot(ecdf(a))
points(b, col = 'red', lwd = 2)

The points doesn't appear. I think i have to fit the points with the curve to find the y axis value which correspond to it, but i don't really know how to do it. If someoane can help me. Thanks!

1 Answers1

0

ecdf returns a function. You can do this:

set.seed(42)
a <- runif(1000, 0, 10)
b <- 1.5

e <- ecdf(a)

plot(e)
points(b, e(b), col = 'red', cex= 2)

resulting plot

Roland
  • 127,288
  • 10
  • 191
  • 288