-1

In R, how do you calculate the probability of negative or zero readings occurring? μ and σ are giving.

Mara
  • 1
  • There are many similiar questions to this, e.g. https://stackoverflow.com/questions/29476023/how-to-calculate-probability-in-normal-distribution-with-r https://stackoverflow.com/questions/55545973/how-to-use-pnorm-in-r-to-calculate-the-probability-that-the-mean-of-n-random-var – Max M Dec 18 '20 at 14:15

1 Answers1

3

You can use the distribution function of the gaussian distribution:

pnorm(0,μ,σ)

(I guess you are speaking about gaussian distribution)


edit

The pnorm is the cumulative density function. Its values are between 0 and 1, and its value at x gives the area under the gaussian curve from -inf to x. In my example below, the value at 0 of pnorm give the area in pink under the gaussian curve, so the probability you are looking for, i.e. the probability of sampling a value following the corresponding gausian distribution with a value below or equal to 0.

enter image description here

denis
  • 5,580
  • 1
  • 13
  • 40
  • But why "0"? what does that mean? – Mara Dec 18 '20 at 13:07
  • @Mara. The assumption is that you want the cdf, F(x) <= 0 where x is normally distributed. So for example, if m=4, sd=2, P(x<=0) = pnorm(0, 4, 2) = 0.0227. The probability that x > 0 is simply 1 - prnorm(0, 4, 2). You have to clarify if you want something else. – SteveM Dec 18 '20 at 13:41