From: Duncan Murdoch <murdoch_at_stats.uwo.ca>

Date: Thu 01 Dec 2005 - 03:05:14 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 01 04:03:21 2005

Date: Thu 01 Dec 2005 - 03:05:14 EST

On 11/30/2005 10:14 AM, Scott Story wrote:

> I am trying to write a function that will solve a simple system of

*> nonlinear equations for the parameters that describe the beta
**> distribution (a,b) given the mean and variance.
**>
**>
**> mean = a/(a+b)
**> variance = (a*b)/(((a+b)^2) * (a+b+1))
**>
**> Any help as to where to start would be welcome.
*

You should use a package like Maple or Mathematica (or just some pencil and paper work) to determine the solution. Then the function is really easy to write.

Maple gives

> solve({mean = a/(a+b),variance = (a*b)/(((a+b)^2) * (a+b+1))},{a,b});

{a = -mean*(variance+mean^2-mean)/variance, b = (variance+mean^2-mean)*(mean-1)/variance}

from which you can write your own function pretty easily.

Duncan Murdoch

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 01 04:03:21 2005

*
This archive was generated by hypermail 2.1.8
: Thu 01 Dec 2005 - 09:31:48 EST
*