[R] Solving Equations

R. Michael Weylandt michael.weylandt at gmail.com
Sun Jan 22 21:56:56 CET 2012


CRAN suggests it's not available for windows since the build can't be
automated: http://cran.r-project.org/bin/windows/contrib/r-release/ReadMe

but it suggests builds are available from Prof Ripley (to whom be
honor and praise for ever and ever, amen!) here:
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.14/

Michael

On Sun, Jan 22, 2012 at 3:52 PM, David Stevens <david.stevens at usu.edu> wrote:
> I'm following this thread and got curious about Ryacas. After installing
> yacas and Ryacas, I was alerted to the missing XML package for Windows.
> I couldn't find in on a couple of mirrors so I tried
> http://www.omegahat.org/RSXML/ and
>
> install.packages("XML", repos = "http://www.omegahat.org/R")
>
> but got
>
> Installing package(s) into 'D:/Users/David Stevens/Documents/R/win-library/2.14'
> (as 'lib' is unspecified)
> Warning message:
> In getDependencies(pkgs, dependencies, available, lib) :
>   package 'XML' is not available (for R version 2.14.1)
>
> for my troubles. The date on the omegahat site is 17 Jan 2012. Am I missing something?
>
> David Stevens
>
>
>
> On 1/22/2012 12:39 PM, Gabor Grothendieck wrote:
>> On Sun, Jan 22, 2012 at 1:25 PM, Eliano<eliano.m.marques at gmail.com>  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?
>>>
>> The equations giving a and b as a function of m and v are:
>>
>>> library(Ryacas)
>>> a<- Sym("a"); b<- Sym("b")
>>> m<- Sym("m"); v<- Sym("v")
>>> Solve( List(a/(a+b) == m, a*b/((a+b)^2*(a+b+1)) == v), List(a, b) )
>> expression(list(list(a == m^2 * (1 - m)/v - m, b == a/m - a)))
>>
>> Based on the above we write this R function:
>>
>> beta.parms<- function(m, v) {
>>     a<- m^2 * (1-m)/v - m
>>     b<- a/m - a
>>     c(a = a, b = b)
>> }
>>
>> and run it:
>>
>>> beta.parms(m = 0.5, v = 0.05)
>> a b
>> 2 2
>>
>
> --
> David K Stevens, P.E., Ph.D., Professor
> Civil and Environmental Engineering
> Utah Water Research Laboratory
> 8200 Old Main Hill
> Logan, UT  84322-8200
> 435 797 3229 - voice
> 435 797 1363 - fax
> david.stevens at usu.edu
>
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list