2

I have a cumulative distribution function from a standard normal distribution and I have a given y value, which should be 0.95

dist <- function(x) pnorm(x,0,1)

How can I solve the equation 0.95 = dist(x) for x?

Codey
  • 1,131
  • 2
  • 15
  • 34
  • 2
    The standard normal distribution function is never equal to `0.95`. I assume you really want the point where the cumulative distribution function equals 0.95. In that case just do `qnorm(.95)` – IceCreamToucan May 23 '18 at 16:48

1 Answers1

2

You can use the uniroot function as follows:

dist <- function(x) pnorm(x,0,1) - 0.95
uniroot(dist, interval = c(-1,4))

which would give you the same answer as qnorm(0.95,0,1).

ABIM
  • 364
  • 3
  • 19