Skip to content

simple NLS query

3 messages · Charles C. Berry, ivo welch

#
dear R experts:  I am trying to orient myself using nls().  so, I am
just trying to copy and adapt an example in the nls() function:

  > d= data.frame( y= runif(10), x= runif(10) )
  > nls( y ~ 1/(1+x), data = d, start= list(x=0.5,y=0.5), trace=TRUE)
  Error in n%%respLength : non-numeric argument to binary operator

the error message seems internal, so it would be nicer if there was a
better error message.  I presume my mistake is so basic that an R
expert sees the problem in 1 second.

(if I manage to figure this one out, my next step will be to learn how
I can get [presumably asymptotic ML] standard errors on estimated
coefficients.  I hope I am looking in the right direction with the
nls() function.)

advice appreciated.

regards,

/ivo
#
See the nls help page:

Arguments

 	formula a nonlinear model formula including variables and parameters.

and you have

 	y ~ 1/(1+x)

which does not seem to match the requirement of the help page.

What are the unknowns for which you were hoping nls would solve??
On Sat, 23 Dec 2006, ivo welch wrote:

            
Look at the help page for nls. Specifically under 'Details'.


I hope I am looking in the right direction with the
Charles C. Berry                        (858) 534-2098
                                          Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	         UC San Diego
http://biostat.ucsd.edu/~cberry/         La Jolla, San Diego 92093-0717
#
duh!  thanks.

  summary(nls( y ~ 1/(1+b*x), data = d, start= list(b=0.5)))

works, of course.

/iaw
On 12/23/06, Charles C. Berry <cberry at tajo.ucsd.edu> wrote: