Many Thanks Berend.

2012/1/22 Berend Hasselman [via R] <ml-node+s789695n4318895...@n4.nabble.com
>

>
> On 22-01-2012, at 19:25, Eliano wrote:
>
> > People,
> >
> > I'm researching some Bayesian statistic topics and in the midle of my
> study
> > i found a very simple problem and i'm trying to find a simple package to
> > solve this type of equations:
> >
> > Lets say that i need to compute beta values for the beta distribution
> and i
> > now for example:
> >
> > E(teta)=a/(a+b) = 0,5
> > Var(teta)=ab/((a+b)^2(a+b+1))=0.05
> >
> > So if i want to solve this to non-linear system to find a,b for the beta
> > distribution wich pack should i use?
> >
> > I know that a=2 and b=2 because i calculated it.
> >
>
> There is a package nleqslv which can handle you system.
>
>
> library(nleqslv)
>
> eqf <- function(x) {
>     a <- x[1]
>     b <- x[2]
>     y <- numeric(2)
>     y[1] <- a/(a+b) - 0.5
>     y[2] <- a*b/((a+b)^2 * (a+b+1)) -0.05
>     y
> }
>
> x.start <- c(1,1)
>
> nleqslv(x.start,eqf)
>
>
> Berend
>
> ______________________________________________
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4318895&i=0>mailing 
> list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
> http://r.789695.n4.nabble.com/Solving-Equations-tp4318784p4318895.html
>  To unsubscribe from Solving Equations, click 
> here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4318784&code=ZWxpYW5vLm0ubWFycXVlc0BnbWFpbC5jb218NDMxODc4NHwtMTk0ODk5MDYy>
> .
> NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: 
http://r.789695.n4.nabble.com/Solving-Equations-tp4318784p4318915.html
Sent from the R help mailing list archive at Nabble.com.
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to