[R] Non-negative solutions to complicated equations

stenort stenort at merchantsconnected.org.uk
Thu Jul 23 17:25:52 CEST 2009


Hi Ravi, apologies for the typos. I believe these have been corrected, please
see the new version of the question on the forum page


Ravi Varadhan wrote:
> 
> Hi,
> 
> I found at least 2 typos in your function.  Can you check your equations
> carefully to make sure that they are correct and then send me a
> reproducible
> version of the code that I can cut and paste into my R session?
> 
> Ravi. 
> 
> 
> ----------------------------------------------------------------------------
> -------
> 
> Ravi Varadhan, Ph.D.
> 
> Assistant Professor, The Center on Aging and Health
> 
> Division of Geriatric Medicine and Gerontology 
> 
> Johns Hopkins University
> 
> Ph: (410) 502-2619
> 
> Fax: (410) 614-9625
> 
> Email: rvaradhan at jhmi.edu
> 
> Webpage:
> http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h
> tml
> 
>  
> 
> ----------------------------------------------------------------------------
> --------
> 
> 
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On
> Behalf Of stenort
> Sent: Thursday, July 23, 2009 6:08 AM
> To: r-help at r-project.org
> Subject: [R] Non-negative solutions to complicated equations
> 
> 
> Hi all,
> I have a system of 3 equations with many defined parameters and 3
> variables
> I need to find solutions to. I actually know the solutions I'm aiming for
> (0.07,0.287,0.0061) but R tends to give me (0,0,0).
> I tried the "BB" package but don't really follow how to refine my
> solutions
> from that; these are wrong so far. Here's my code from trying that:
>> f<-function(x){
> + x1<-x[1]
> + x2<-x[2]
> + x3<-x[3]
> + 
> + F<-rep(NA,3)
> + F[1]<-(0.075*x3+0,175*x2)*0.065*exp(-0.03*25)
> + F[2]<-(x2/0.075)*((1/50)/(0.065*0.5.125*0.872214*(1-(x2*(56/25))))-0.1
> + 75)
> + F[3]<-(x3/0.175)*((1/70)/(0.065*0.366*0.872214*(1-(x3*(66/35))))-0.075
> + )
> + return(F)
> + }
>> p0<-c(0.1,0.1,0.1)
>> dfsane(par=p0,fn=f,control=list(maxit=3000))
> 
> 
> I have substituted estimated values for all the parameters into the above
> equations.
> Thanks
> --
> View this message in context:
> http://www.nabble.com/Non-negative-solutions-to-complicated-equations-tp2462
> 2867p24622867.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.
> 
> ______________________________________________
> 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/Non-negative-solutions-to-complicated-equations-tp24622867p24628265.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list