# [R] Re: Info

Spencer Graves spencer.graves at pdf.com
Wed Jul 16 15:12:51 CEST 2003

```On 7/11, I replied to one of your earlier posts on this problem wiht the
following:

chemYield <-
function(a, x)(a[1]+(a[3]-a[2])/(1+exp(-a[2]*(x-a[4]))

This can be used in "optim" but not "nls".  Mimicking an example in the
documentation for "nls" (package nls), I suspect the following should
work:

yield.fit <- nls( y ~ a + (c.-a)/(1+exp(-b*(x-m))),
data = yield.data.frame,
start = list( a= 0, c.=2, b= 1, m=4 ),
trace = TRUE )

where "y" and "x" are columns of "yield.data.frame.  [Note:  I suggest
you avoid using reserved words like "c":  "c" is a function in R.  R is
smart enough to distinguish between a function "c" and a non-function
object in many contexts.  However, I try to avoid relying on this.  Note
that here I changed your "c" to "c.".]

Have you tried something like these two?  I suggest you try them both
with a very simple toy example with 4 or 5 observations.  If you can't
get both of them to work, please submit the data with your failed
attempts and the resulting error message(s).  With that detail, someone
else will likely be able to respond in seconds.  Without it, we may no
be able to help you.  We've been at this almost a week and still do not
have the problem solved largely because people like me are shooting in
the dark:  We can't figure out what you are missing, and you aren't
providing enough detail to help us see the gap.

hope this helps.  spencer graves

Andrea Calandra wrote:
> Sorry
>
> I'm student in biomedical engineer and i have to solve this formula
> for immuno-assay. I need to design a calibration curve
>
> But i don't understand How can i write this formula in R language:
> y = a + (c - a) /(1+ e[-b(x-m])
>
> where
> x = ln(analyte dose + 1)
> y = the optical absorbance data
> a = the curves top asymptote
> b = the slope of the curve
> c = the curves bottom asymptote
> m = the curve X intercept
>
> I have to calculate the parameters (a,b,c,m).After with X that i know
> i calculate the Y.
>
>
>>==========================
>>Date: Tue, 15 Jul 2003 19:30:31 -0700 (PDT)
>>From: Rick Fletcher <fletcher at uidaho.edu>
>>To: Andrea Calandra <a.CALANDRA at mclink.it>
>>Subject: Re: Info
>>==========================
>>
>>
>>Andrea, if you only have five data points, it will be very difficult
>>to
>>fit all those parameters so they give a unique solution.  If
>>you want to
>>fit all of your parameters at once, you need many more data points.
>>
>>On Tue, 15 Jul 2003, Andrea Calandra wrote:
>>
>>
>>>but i have a question
>>>
>>>i have Five point with X and Y that know (concentration and
>>
>>optical density) how can interpolate the curve
>>
>>>with folowing FIVE INTERPOLATION
>>>
>>>y = a + (c - a) /(1+ e[-b(x-m])
>>>
>>>>>where
>>>>>x = ln(analyte dose + 1)
>>>>>y = the optical absorbance data
>>>>>a = the curves top asymptote
>>>>>b = the slope of the curve
>>>>>c = the curves bottom asymptote
>>>>>m = the curve X intercept
>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>==========================
>>>>Date: Mon, 07 Jul 2003 11:11:28 -0700 (PDT)
>>>>From: Rick Fletcher <fletcher at uidaho.edu>
>>>>To: Andrea Calandra <a.CALANDRA at mclink.it>
>>>>Subject: Re: Info
>>>>==========================
>>>>
>>>>Did you find a solution yet?  I am sorry for the delay in
>>>
>>response,
>>
>>>>but
>>>>the July 4th weekend is a big holiday here.  It is the day
>>>
>>we
>>
>>>>celebrate
>>>>our independence from England.
>>>>
>>>>Do you still need help?
>>>>
>>>>
>>>>On Fri, 4 Jul 2003, Andrea Calandra wrote:
>>>>
>>>>
>>>>>i take your name on the web!
>>>>>thank you
>>>>>
>>>>>
>>>>>>==========================
>>>>>>Date: Thu, 03 Jul 2003 11:05:24 -0700 (PDT)
>>>>>>From: Rick Fletcher <fletcher at uidaho.edu>
>>>>>>To: Andrea Calandra <a.CALANDRA at mclink.it>
>>>>>>Subject: Re: Info
>>>>>>==========================
>>>>>>
>>>>>>
>>>>>>Hello,
>>>>>>
>>>>>>May I ask how you got my name?  Thank you.
>>>>>>
>>>>>>
>>>>>>On Thu, 3 Jul 2003, Andrea Calandra wrote:
>>>>>>
>>>>>>
>>>>>>>HI
>>>>>>>
>>>>>>>I'm a student in chemical engineering at university
>>>>>>
>>of
>>
>>>>Rome,
>>>>
>>>>>>and i have to implement an algoritm about FIVE PARAMETERS
>>>>>
>>>>INTERPOLATION
>>>>
>>>>>>for a calibration curve (dose, optical density)
>>>>>>
>>>>>>>y = a + (c - a) /(1+ e[-b(x-m])
>>>>>>>
>>>>>>>where
>>>>>>>x = ln(analyte dose + 1)
>>>>>>>y = the optical absorbance data
>>>>>>>a = the curves top asymptote
>>>>>>>b = the slope of the curve
>>>>>>>c = the curves bottom asymptote
>>>>>>>m = the curve X intercept
>>>>>>>
>>>>>>>Have you never seen this formula, because i don't fine
>>>>>>
>>>>information
>>>>
>>>>>>or
>>>>>>
>>>>>>>
>>>>>>>Can i help me
>>>>>>>Andrea Calandra
>>>>>>>
>>>>>>>thank you
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>Rick
>>>>>>T. Rick Fletcher   -   http://www.chem.uidaho.edu/~fletcher/
>>>>>>Associate professor of chemistry  |  That's Idaho, not
>>>>>
>>Iowa.
>>
>>>>>>University of Idaho               |  Upper Left Hand
>>>>>
>>Corner.
>>
>>>>>>Moscow, ID 83844-2343             |  No, I don't grow
>>>>>
>>potatoes.
>>
>>>>>
>>>>>
>>>>>
>>>>Rick
>>>>T. Rick Fletcher   -   http://www.chem.uidaho.edu/~fletcher/
>>>>Associate professor of chemistry  |  That's Idaho, not Iowa.
>>>>University of Idaho               |  Upper Left Hand Corner.
>>>>Moscow, ID 83844-2343             |  No, I don't grow potatoes.
>>>
>>>
>>>
>>Rick
>>T. Rick Fletcher   -   http://www.chem.uidaho.edu/~fletcher/
>>Associate professor of chemistry  |  That's Idaho, not Iowa.
>>University of Idaho               |  Upper Left Hand Corner.