Home > Enterprise >  Integrate Normal Distribution Between 2 Values
Integrate Normal Distribution Between 2 Values

Time:05-24

I want to calculate the integral of the Normal Distribution at exactly some point - I know that to do this, this is the equivalent of integrating the Normal Distribution at that point and at some point slightly after that point : then, you can subtract both of these values and get an approximate answer.

I tried doing this in R:

a = pnorm(1.96, mean = 0, sd = 1, log = FALSE)
b = pnorm(1.961, mean = 0, sd = 1, log = FALSE)

final_answer = b - a

 #5.83837e-05
  • Is it possible to do this in one step instead of manually subtracting "a" and "b"?

Thank you!

CodePudding user response:

We need to be clear about what you are asking here. If you are looking for the integral of a normal distribution at a specific point, then you can use pnorm, which is the anti-derivative of dnorm.

We can see this by reversing the process and looking at the derivative of pnorm to ensure it matches dnorm:

# Numerical approximation to derivative of pnorm:
delta <- 10^-6

(pnorm(0.75   delta) - pnorm(0.75)) / delta
#> [1] 0.3011373

Note that this is a very close approximation of dnorm

dnorm(0.75)
#> [1] 0.3011374

So the anti-derivative of a normal distribution density at point x is given by:

pnorm(x)

CodePudding user response:

You can try this

> diff(pnorm(c(1.96, 1.961), mean = 0, sd = 1, log = FALSE))
[1] 5.83837e-05
  • Related