How can I determine the standard deviation of a normal distribution with known mean and a known percentile value?
The known percentile value would be on the correct side of the mean (eg, for percentile > 0.5, the value > mean), and the percentile would not be 0.5, as that would simply be equal to the mean, and therefore would tell one nothing about the variability.
This is an R function I use occasionally to do this; is there an analytic or arithmetic method/formula that could solve this? Would it be faster to compute?
#' Determine y in the equation `qnorm(mean=m,sd=y,p=p)==x`
get_sd_from_quantile_score <- function(m, p, x) {
get_quantile_score <- function(y) {
qnorm(mean=m,sd=y,p=p)
}
f <- function(y) { (get_quantile_score(y) - x)^2 }
opt <- optim(par = 1, fn = f, method = 'CG')
return(opt$par)
}