[R] specifying a function in nls

From: Bill Shipley <bill.shipley_at_usherbrooke.ca>
Date: Sat 17 Jul 2004 - 01:19:45 EST

Hello. I am trying to understand the syntax of the nonlinear least squares function (nls) when the function definition is made outside of the call. Here is the context.

  1. If I specify the following command, it works fine:

> fit2<-nls(

+ A~Am*(1-exp(-alpha*(I-LCP))),data=dat1,

+ start=list(Am=3.6,alpha=0.01,LCP=20))  

2. Now, I want to be able to specify the function definition outside of nls. I do the following:  

> Mitscherlich<-function(Am,alpha,I,LCP,...){



and then:  

> fit3<-nls(

+ A~Mitscherlich,data=dat1,

+ start=list(Am=2.7,alpha=0.006,LCP=45))  

and I get the error message: Error in lhs - rhs : non-numeric argument to binary operator  

What am I doing wrong?


Bill Shipley

Subject Matter Editor, Ecology

North American Editor, Annals of Botany

Département de biologie, Université de Sherbrooke,

Sherbrooke (Québec) J1K 2R1 CANADA


 <http://callisto.si.usherb.ca:8080/bshipley/> http://callisto.si.usherb.ca:8080/bshipley/  

        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jul 17 01:27:56 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 02:36:39 EST