[R] question about non-linear least squares in R
Moshe Olshansky
m_olshansky at yahoo.com
Wed Sep 5 10:33:06 CEST 2007
Below is one possibility:
If you knew MA you would get a regular linear
least-squares for parameters A,B and constant which
can be easily solved. So now you can define a function
f(MA) which returns that value. Now you must minimize
that f - a function of one argument. It can have
several local minima and so you must be careful but I
believe that minimizing (even "bad") function of one
argument should be easier than your original problem.
Regards,
Moshe.
P.S. if you do this I would be interested to know
whether this works.
--- "Yu (Warren) Wang" <yu.wang at pdf.com> wrote:
> Hi, everyone,
> My question is: It's not every time that you can
> get a converged
> result from the nls function. Is there any solution
> for me to get a
> reasonable result? For example:
>
> x <-
>
c(-0.06,-0.04,-0.025,-0.015,-0.005,0.005,0.015,0.025,0.04,0.06)
>
> y <-
>
c(1866760,1457870,1314960,1250560,1184850,1144920,1158850,1199910,1263850,1452520)
>
> fitOup<- nls(y ~ constant + A*(x-MA)^4 + B*(x-MA)^2,
>
> start=list(constant=10000000, A=100000000,
> B=-1000000, MA=0),
> control=nls.control(maxiter=100, minFactor=1/4096),
> trace=TRUE)
>
>
>
> For this one, I cannot get the converged result,
> how can I reach it? To
> use another funtion or to modify some settings for
> nls?
>
> Thank you very much!
>
> Yours,
>
> Warren
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>
More information about the R-help
mailing list