[R] nls, the four parameter logistic equation, and prediction band

John C Nash nashjc at uottawa.ca
Tue Sep 13 16:51:02 CEST 2011


The error msg is telling you that R cannot evaluate the loss function, so you should not
expect answers.

You might try examining the data -- Are there NA or Inf entries?

Or prepare a dataframe with just X and Y, sort by X and graph.

Then check the nls computations by sampling, say, every 100 X's to give you a dataset with
about 160 observations. If that doesn't work, it is at least small enough to include in a
second posting that has a workable example.

JN


On 09/13/2011 06:00 AM, r-help-request at r-project.org wrote:
> Message: 79
> Date: Mon, 12 Sep 2011 17:12:14 -0700
> From: sg <listerr01 at gmail.com>
> To: r-help at r-project.org
> Subject: [R] nls, the four parameter logisitc equation, and prediction
> 	band
> Message-ID:
> 	<CAELtrnGUXprB3q0FPvMFamUjtkufnwaFju_BDunU-r-e2cKagg at mail.gmail.com>
> Content-Type: text/plain
> 
> I have uploaded a datafile that contains the following two variables: time
> (X value) and response (Y value).  This is a fairly extensive file (with >
> 16000 entries).  I have two questions:
> 
> 1. I want to use the following equation to regress Y on X: Y-hat = min +
> (max-min)/(1 + (X/EC50)^Hillslope).
> 
> Here is my R command:
> 
> nlsout <- nls(Y ~ (0 - (100-0)/(1 + (X/EC50)^hill)), start=c(EC50=125,
> hill=-1))
> 
> However, I get the following error message:
> 
> Error in numericDeriv(form[[3L]], names(ind), env) :
>   Missing value or an infinity produced when evaluating the model
> Could someone explain the error message to me, please, and what I need to do
> to be able to run the command without error?  The problem is that this exact
> same formula works on the exact same dataset when I use a macro in Excel
> (unfortunately I don't have the code, though).
> 
> 
> 2. I want to compute the prediction band for the above regression.
> 
> Any help will be greatly appreciated.
> 
> Thanks,
> 
> Joe
>



More information about the R-help mailing list