VividCortex / ebooks

LaTeX source files for VividCortex's ebooks
https://www.vividcortex.com/resources/
181 stars 26 forks source link

USL - updates to the R package for USL modeling #3

Open xaprb opened 8 years ago

xaprb commented 8 years ago

I had a conversation with Stefan Möding, the author of the USL R package about the shortcomings I mentioned:

Me:

My memory is a little vague on the details now, but as I recall, a few things happened when I was working with it, which made me prefer to work without an abstraction:

  1. A lot of the data I work with has things like negative coefficients after regression, and that caused an error if I remember correctly.
  2. The "lambda" parameter is not present -- it assumes everything is normalized relative to C(1) perhaps?
  3. It requires a measurement at N=1 perhaps? Much of the data I work with doesn't have that.

For the cases where it worked I thought it was very nice, but I am not much of an R programmer so I couldn't immediately see how to work around the spots where I had trouble. In addition I thought it more valuable to demonstrate to readers how to work with the equations directly, rather than using an abstraction.

Stefan Möding:

I see your points. For your second & third point: yes, that is correct for the default setting. The implementation follows the algorithm presented by Dr. Gunther in his book and therefore expects the data for N=1 / C(1) to be available.

But there are two alternative implementations available by setting the „method“ parameter of the „usl“ function to either the value „nls“ or „nlxb“. Both methods use nonlinear regression without the need for N=1 / C(1) to be available in the data. They estimate your lambda - I named it scale factor - in addition to sigma and kappa.

Unfortunately the „nls“ method often fails to provide an answer since the internal algorithm does not converge. But the „nlxb“ method - an alternative implementation imported from a different package - is pretty good. It also considers parameter bounds, so sigma and kappa will not be negative with this algorithm.

smoeding commented 8 years ago

Recently I updated the vignette for the usl package. It is a bit of prose about my intention how the package can be used.

https://cran.r-project.org/web/packages/usl/vignettes/usl.pdf

Regards, Stefan