[R] nonlinear curve fit of an implicit function

Ravi Varadhan rvaradhan at jhmi.edu
Tue Oct 5 17:44:58 CEST 2010


You can solve this as a (nonlinearly) constrained optimization problem:

Given:  x, y.obs; both in R^n
Minimize the objective function:  sum( (y - y.obs)^2 ) 
where `y' is such that it satisfies the constraints:   (A+B+C)*log((B+C+y)/C)-A*log((B-y)/B)=(B+C)*D*x

Do you have other constraints on A,B, and C, such as positivity, etc?  If so, you need to incorporate them as well.

You can take a look at the package "alabama", which has 2 optimizers: `auglag' and `constrOptim.nl'.


Hope this helps,
Ravi.

____________________________________________________________________

Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619
email: rvaradhan at jhmi.edu


----- Original Message -----
From: "Schmitt, H.  (Heike)" <H.Schmitt at uu.nl>
Date: Tuesday, October 5, 2010 11:10 am
Subject: [R] nonlinear curve fit of an implicit function
To: r-help at r-project.org


> Hello,
>   
>  I want to perform a nonlinear curve fit in order to obtain parameter
>  estimates from experimentally determined data (y in dependence of x),
>  but with an implicit function, thus, a function of which I cannot
>  isolate y on the left-hand side of the equation. As far as I understand,
>  the functions I found up to now (nls, optim) all work only for explicit
>  functions.
>   
>  My data looks like
>  x<-c(4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52,
>  55, 58, 61)
>  y<-c(0.0, -0.1, 0.0, 0.1, 0.5, 0.9, 1.4, 2.3, 3.1, 3.4, 3.8, 4.2, 4.6,
>  4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5)
>  
>   
>  
>  My function is a sigmoidal growth function based on an integrated form
>  of the Monod function:
>  
>   (A+B+C)*log((B+C+y)/C)-A*log((B-y)/B)=(B+C)*D*x 
>  
>   
>  
>  Your ideas would be greatly appreciated. 
>  
>   
>  
>  Heike Schmitt
>  
>  Utrecht University
>  
>   
>  
>  
>  	[[alternative HTML version deleted]]
>  
>  ______________________________________________
>  R-help at r-project.org mailing list
>  
>  PLEASE do read the posting guide 
>  and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list