pveber / morse

Companion R package for MOSAIC website
7 stars 5 forks source link

predict functions - option data_predict = NULL #277

Open SingerAl opened 5 years ago

SingerAl commented 5 years ago

Dear MORSE package developers, thank you for your recent update on CRAN (MORSE version 3.2.0).

I found two issues with the option 'data_predict = NULL' in several predict functions: 1.) The documentation says: 'If NULL, prediction is based on x object of class survFit used for fitting'. It is unclear what 'x' refers to. It would be nice, if you could clarify the documentation. 2.) Intuitively and from the documentation, I would expect that for the option 'data_predict = NULL', the function would use the slot 'original.data' from a survFit-object. Yet, code inspection idicates that information from the slot 'jags.data' is used to setup the predictions. But 'jags.data' does not necessarily contain all conc measurements from 'original.data'. Please check, if this is an intended behaviour or clarify the help text.

With kind regards, Alex

SingerAl commented 5 years ago

Dear MORSE package developers, just to be more precise: my second comment refers to the predict_ode function, which uses the 'time' and 'conc', which do not reflect the exposure profile of the 'original.data' in my case. 'time_long' and 'conc_long' as used in 'predict.survFit' appropriately represent the exposure profile. With kind regards, Alex

sandrinecharles commented 5 years ago

Dear Alex, Regarding your first comment, the documentation will be clarified and based on x object of class survFit will be replaced by based on an object of class survFit. Thank you for having advertised us on this aspect. About your second comment, when data_predict = NULL in the predict_Nsurv() function, predictions are made where we had observations for performing the fit. This also applies for the other predict() functions. As you noticed, there is a tiny difference in results when using the functions predict() and predict_ode(). This is due to the way the exposure profile is dealt with. When using function predict(), time_long and conc_long vectors are home-made in order to interpolate the concentration profiles before making predictions (by using function approxfun() in R). When using function predict_ode(), a solver is used that interpolates concentration profiles itself. Best regards, Sandrine