# Find parameters $\alpha$ and $\beta$ of a beta distribution, if I have one quantile and the mean [duplicate]

Suppose I'm given the mean and one quantile (e.g. the 95% quantile) of a random variable $x$, and I want to find the parameters $\alpha$ and $\beta$ of a Beta distribution that has the same mean and quantile. Is there an efficient way to do it in R?

• @DilipSarwate - she actually tried to ask this question as an answer to that other one, but it was deleted as it wasn't an answer to the other one, so I suspect the question really is "how to do this in R", rather than "how to do this". – jbowman Jun 6 '14 at 18:25
• If it is possible either of $\alpha$ or $\beta$ could be close to zero, then a carefully crafted solution is needed because the natural general-purpose ones can fail to work. For instance, the Beta$(1/10,1/5)$ distribution has a mean of $1/3$ and a $95\%$ quantile of $0.999933679286$. Any good solution should tell you that $\alpha$ is very close to $0.1$! – whuber Jun 6 '14 at 18:44
• @jbowman I would have thought "How to do this?" would be a more interesting question that "How to do this in R?" on stats.SE; the latter seems more appropriate for a programming website. – Dilip Sarwate Jun 6 '14 at 18:45

m <- 1/4   # mean