aravind-j / germinationmetrics

Seed Germination Indices and Curve Fitting
https://aravind-j.github.io/germinationmetrics/
3 stars 1 forks source link

Regular time intervals #2

Closed RoJoRZ closed 5 years ago

RoJoRZ commented 5 years ago

Dear Aravind,

I am testing your package and do really like the many features which are available! Unfortunately I am running into a problem because our germination data does not have regular time intervals (we score per hour, not days). Several of your functions test for regularity of the intervals by: length(unique(diff(intervals))) != 1 I am wondering why this has been included (as it is not a prerequisite for curvefitting) and whether there could be a workaround for working with irregular time intervals.

Regards, Ronny

aravind-j commented 5 years ago

@RoJoRZ I agree it is not required for curve fitting. The check is intended to just shows a warning in case of non uniform intervals. However it internally uses t50() function to get some starting values for the non linear model fitting.

Uniform intervals are preferred for some of the germination indice functions such as MeanGermPercent(), MeanGermNumber(), MeanGermRate(), MeanGermTime(), TimsonsIndex(), GermRateGeorge(), GermSpeed(), GermValue(), GermSynchrony() and t50() in which the check results in an error in case of non uniform intervals.

The errors have been now converted to warnings so that irregular time intervals may be used. You can install the development version and try it with your data.

if (!require('devtools')) install.packages('devtools')
install.packages('germinationmetrics', dependencies=TRUE)
RoJoRZ commented 5 years ago

Great! thanks a lot for our quick response. I am going to try. Regards, Ronny

rvberloo commented 5 years ago

Hi Aravind, I tried the dev version with irregular timed data. Indeed some errors are converted to warnings but I still get errors also like:

Error in t50(germ.counts, intervals, partial, method = "coolbear") : 'intervals' are not uniform.

is that the intended behaviour? I got confused from your remarks above (the word 'preferred' does not mean 'required' does it?)

aravind-j commented 5 years ago

Can you please specify for which function, the errors are shown.

The dev version shows these as warnings now.

x <- c(0, 0, 0, 0, 4, 17, 10, 7, 1, 0, 1, 0, 0, 0)
y <- c(0, 0, 0, 0, 4, 21, 31, 38, 39, 39, 40, 40, 40, 40)
int <- c(1,  2,  3,  4,  5,  6,  9, 10, 11, 12, 13, 14, 15, 18)
t50(germ.counts = x, intervals = int, method = "coolbear")

What I meant by 'preferred' is that for some functions, the results would be more precise, if the intervals are uniform. So for those functions a warning is shown.

rvberloo commented 5 years ago

I am sorry , I used your code above but that still installs the regular version I now see, will try again with the dev version..