Optimization package

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Optimization package

Diviya Smith
Hi there,

I have a complex math equation which does not have a closed form solution.
It is -

y <- (p*exp(-a*d)*(1-exp((d-p)*(a-x[1]))))/((p-d)*(1-exp(-p*(a-x[1]))))

For this equation, I have all the values except for x[1]. So I need to solve
this problem numerically. Can anyone suggest an optimization package that I
can use to estimate the value for x[1]?

Thanks in advance,

Diviya

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: Optimization package

Berend Hasselman
Diviya Smith wrote
Hi there,

I have a complex math equation which does not have a closed form solution.
It is -

y <- (p*exp(-a*d)*(1-exp((d-p)*(a-x[1]))))/((p-d)*(1-exp(-p*(a-x[1]))))

For this equation, I have all the values except for x[1]. So I need to solve
this problem numerically. Can anyone suggest an optimization package that I
can use to estimate the value for x[1]?
So you have data for : a, d, p and y?
Define a function

f <- function(x) y - (p*exp(-a*d)*(1-exp((d-p)*(a-x))))/((p-d)*(1-exp(-p*(a-x))))

and use uniroot to solve f(x) = 0 and set x[1] to the root found by uniroot.

/Berend
Reply | Threaded
Open this post in threaded view
|

Re: Optimization package

Paul Hiemstra-2
In reply to this post by Diviya Smith
 On 09/14/2011 10:37 PM, Diviya Smith wrote:

> Hi there,
>
> I have a complex math equation which does not have a closed form solution.
> It is -
>
> y <- (p*exp(-a*d)*(1-exp((d-p)*(a-x[1]))))/((p-d)*(1-exp(-p*(a-x[1]))))
>
> For this equation, I have all the values except for x[1]. So I need to solve
> this problem numerically. Can anyone suggest an optimization package that I
> can use to estimate the value for x[1]?
>
> Thanks in advance,
>
> Diviya
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

Google for "R optimization".

Paul

--
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770

______________________________________________
[hidden email] 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.