# [R] Problems with nls-function

Michael Petram Michi.Pe at web.de
Wed Aug 8 16:51:39 CEST 2007

```Dear all

I have got some problems with a least-squares regression using the function nls.

I want to estimate h, k and X of the following formula by using nls :

exp(2*200*(q^2-4*h/k-0.25+(2/k-0.5+4*h^2/k^2)*log(abs((k*q^2+2*h*q-1)/(0.25*k-h-1)))))/((-k*q^2-2*h*q+1)*X)

y as defined by c(0.009747 0.001949 0.000000 0.003899 0.000000 0.000000 0.005848 0.001949)
q as defined by c(-0.7500 -0.6875 -0.5625 -0.4875 -0.4625 -0.4375 -0.4125 -0.3875)

(length of  the real q and y is 46; too long to post them here)

i tought the correct using of nls would be:

Mic<-nls(y~"function", start = list(k=1.0,h=0.1,X=exp(10))

But it doesn`t work. i tryed an easier formula like :

Mic<-nls(y~h*exp(2*k*200*(q^2)), start=list(h=0.1,k=1,X=100000))

The result was the same.

Isn`t  "nls"  the function i should use to solve this regression problem? Which things did i make wrong?

Thank you very much in advance

Michael

_________________________________________________________________________
In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten!

```