From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>

Date: Sat 17 Jul 2004 - 01:28:18 EST

*>
*

*>
*

> + 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:
*

*>
*

*>
*

*>
*

*>
*

*>
*

*>
*

*> Am*(1-exp(-alpha*(I-LCP)))
*

*>
*

*> }
*

*>
*

*>
*

*>
*

*> and then:
*

*>
*

*>
*

*>
*

*>
*

*>
*

*>
*

> + 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?
*

*>
*

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:35:35 2004

Date: Sat 17 Jul 2004 - 01:28:18 EST

Bill Shipley wrote:

> 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,

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

>>fit3<-nls(

> + A~Mitscherlich,data=dat1,

Hi Bill,

I think you want:

fit3 <- nls(A ~ Mitscherlich(Am, alpha, I, LCP),

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

Also, I don't see where you supply "I" (which is a bad choice for a variable name).

There is an example of this in ?nls.

--sundar

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:35:35 2004

*
This archive was generated by hypermail 2.1.8
: Wed 03 Nov 2004 - 22:55:03 EST
*