International dendrochronology discussion list

Text archives Help


[ITRDBFOR] Re: Bug (and fix) in negative exponential detrending in dplR


Chronological Thread 
  • From: Andy Bunn <Andy.Bunn AT wwu.edu>
  • To: ITRDB Forum <itrdbfor AT itrdbfor.org>
  • Cc: Jacob Cecile <jacobcecile AT gmail.com>, Mikko Korpela <mikko.korpela AT aalto.fi>
  • Subject: [ITRDBFOR] Re: Bug (and fix) in negative exponential detrending in dplR
  • Date: Tue, 26 Nov 2013 22:16:55 +0000
  • Accept-language: en-US

Thanks for the report Jacob! This is a legitimate bug and your proposed
solution is a great start – the question of when to apply constraints on the
coefficients of the negative exponential function needs a bit of thought. We
will work on a fix that will likely involve a new argument to
detrend.series() as well as a warning that will alert the user when the nls()
model coefficients produce this behavior. Regardless, there will be a fix in
the next version of dplR. I expect we’ll have a patch in the development
version within a few days. Instructions for using a daily snapshot of the
development version are available here:
https://huxley.wwu.edu/trl/htrl-dplr


Yours in R,
Andy


From: Jacob Cecile
<jacobcecile AT gmail.com<mailto:jacobcecile AT gmail.com>>
Date: Monday, November 25, 2013 at 12:18 PM
To: ITRDB Forum
<itrdbfor AT itrdbfor.org<mailto:itrdbfor AT itrdbfor.org>>
Cc: Andy Bunn
<andy.bunn AT wwu.edu<mailto:andy.bunn AT wwu.edu>>
Subject: Bug (and fix) in negative exponential detrending in dplR

One of the students in our lab noticed that negative exponential detrending
(using detrend.series in dplR) was producing nonsensical negative values for
RWI for some series. In this case, RWI was produced by division so negative
values should be entirely impossible.

Turns out that detrend.series() allows negative values for the intercept term
in the modified negative exponential fit, producing negative values of the
detrending curve (and thus RWI). You can add bounds to nls() pretty easily if
you switch the optimization algorithm to "port", which solves the problem
nicely.

Graphs of the problem before and after the problem are attached. If you want
to replicate the issue / patch dplR, you can find the problem series and all
the code needed to fix and reproduce the problem at
https://github.com/jacobcecile/dplRbugs.

Cheers,
Jacob Cecile



Archive powered by MHonArc 2.6.16.

Top of page