International dendrochronology discussion list

Text archives Help


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


Chronological Thread 
  • From: Jacob Cecile <jacobcecile AT gmail.com>
  • To: ITRDB Forum <itrdbfor AT itrdbfor.org>
  • Cc: andy.bunn AT wwu.edu
  • Subject: [ITRDBFOR] Bug (and fix) in negative exponential detrending in dplR
  • Date: Mon, 25 Nov 2013 12:18:49 -0500

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

Attachment: negative_rwi.jpeg
Description: JPEG image

Attachment: negative_rwi_fixed.jpeg
Description: JPEG image




Archive powered by MHonArc 2.6.16.

Top of page