I need to find the mean in for example 0.02 <- pnorm(400, mean = x, sd = 4)
how do I find x? Is R capable of solving equations?
I need to find the mean in for example 0.02 <- pnorm(400, mean = x, sd = 4)
how do I find x? Is R capable of solving equations?
You might need erfinv
from pracma
to get the mean value mu
, e.g.,
p <- 0.02
x <- 400
sgm <- 4
mu <- x - sgm*sqrt(2)*pracma::erfinv(2*p-1)
such that
> mu
[1] 408.215
> pnorm(400,mu,sgm) # check the obtained value of mu
[1] 0.02
A smarter approach is via qnorm
(thanks to @user20650)
mu <- qnorm(p,x,sgm,FALSE)