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,...){

Am*(1-exp(-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?

Thanks.

 

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

[EMAIL PROTECTED]

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

 


        [[alternative HTML version deleted]]

______________________________________________
[EMAIL PROTECTED] 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

Reply via email to