From: Jarosław Jasiewicz <jarekj_at_amu.edu.pl>

Date: Mon, 28 Jan 2008 09:18:07 +0100

R-help_at_r-project.org 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. Received on Mon 28 Jan 2008 - 08:20:39 GMT

Date: Mon, 28 Jan 2008 09:18:07 +0100

Christian Ritz pisze:

> Hi Jarek,

*>
**> an alternative approach is to provide more precise starting values!
**>
**> It pays off to realise that it's possible to find quite good guesses
**> for some of the parameters in your model function:
**>
**> t ~ tr+ (ts-tr)/ ((1+ (a*h)^n)^(1-(1/n)))
**>
**> The parameters tr and ts correspond to the response t for h equal to
**> infinity and h=0. Therefore by looking at the plot of your data I
**> would set:
**>
**> tr = 0
**> ts = 15000
**>
**> The parameter n must be above 1 in order to achieve a decreasing
**> function. We will not think more about this at the moment.
**>
**> For n somewhat larger than 1 (in which case I would approximate the
**> exponent 1-(1/n) by 1) the parameter a is approximately equal to the
**> reciprocal of the h value resulting in a response halfway between tr
**> and ts. Therefore (again from looking at the plot) I would set a=10.
**>
**> Using the above starting values and simply increasing n in steps of 1
**> eventually results in a useful model fit:
**>
**> ## Fails
**> tmp.m1<-nls(t ~ tr+ (ts-tr)/ ((1+ (a*h)^n)^(1-(1/n))),
**> data = tmp, start = list(a=10, n=1, tr=0, ts=15000))
**>
**> ## Fails
**> tmp.m1<-nls(t ~ tr+ (ts-tr)/ ((1+ (a*h)^n)^(1-(1/n))),
**> data = tmp, start = list(a=10, n=2, tr=0, ts=15000))
**>
**> ## Works!!
**> tmp.m1<-nls(t ~ tr+ (ts-tr)/ ((1+ (a*h)^n)^(1-(1/n))),
**> data = tmp, start = list(a=10, n=3, tr=0, ts=15000))
**>
**> summary(tmp.m1)
**>
**> plot(t ~ h, data = tmp)
**> lines(tmp$h, predict(tmp.m1))
**>
**>
**> I hope you can use this explanation?!
**>
**> Christian
*

yes, I must only check if coefs are expected

but...

fortunalty I found that my problem is solved by package HydroMe

thanks again

Jarek

R-help_at_r-project.org 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. Received on Mon 28 Jan 2008 - 08:20:39 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Mon 28 Jan 2008 - 08:30:10 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*