Search code examples
rprobability

The probability that x is larger than or equal to a given number


I am working with the following data:

x <- c(3.6, 3.7, 2.9, 2.5, 3.6, 1.2, 3.6)

My task is to compute P(x≥2.5), but I cant seem to find the right code to calculate this. Other examples that I have found did not give me the right solution. Any pointers?

Thanks in advance.


Solution

  • If you were to draw a random value y from x, then P(y >= 2.5) = sum(x >= 2.5)/length(x)