R-Lum/Luminescence

calc_MinDose() ... Error in lm.fit(x, ..)

RLumSK opened this issue · 3 comments

The following report based on an email by A. Junge (2019-08-31) received by @RLumSK.

Expected behaviour

Function runs without showing uncontained error messages.

Observed behaviour

Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
  NA/NaN/Inf in 'y'`

Note: The error does not occur all the time, but depends on the sampling.

Running mini example

library(Luminescence)

temp <- structure(list(De = c(0.01, 0.19, 0.24, 0.28, 0.3, 0.36, 0.36,  0.41, 0.46, 0.48, 0.51, 0.58, 0.61, 0.61, 0.79, 0.85, 0.91, 0.92,  1.21, 1.21, 1.31, 1.34, 1.38, 1.39, 1.42, 1.47, 1.6, 1.72, 1.74,  1.87), De.error = c(0.005, 0.009, 0.02, 0.041, 0.02, 0.034, 0.039,  0.027, 0.047, 0.057, 0.03, 0.038, 0.034, 0.061, 0.061, 0.063,  0.052, 0.057, 0.066, 0.066, 0.072, 0.051, 0.08, 0.051, 0.068,  0.084, 0.061, 0.146, 0.122, 0.124)), class = "data.frame", row.names = c(NA,  -30L))

calc_MinDose(temp, sigmab = 0.02, bootstrap = TRUE)

@tzerk Can you please double-check? If ok, please close the issue.

@tzerk Can I close this issue?

tzerk commented

I am fine with minor code change and the warning, works fine when testing it. Though I wonder if it might be possible to state in the warning how many (as a ratio or percentage) of the values were removed before doing the loess fitting. If its just a handful of values that are discared, so be it. But I wonder if we introduce some bias if let's say we remove a third of all values? Providing a value on how many needed to be removed at least gives the user important information on how to interprete the results.