jthaman / ciTools

An R Package for Quick Uncertainty Intervals
GNU General Public License v3.0
106 stars 9 forks source link

Add nls #8

Open wmurphyrd opened 7 years ago

wmurphyrd commented 7 years ago

I've done some work in the past with CI's and PI's for non linear regression using the propagate package. Would you be interested in receiving a PR to add nls model support to this package?

jthaman commented 7 years ago

Definitely interested. Do you have something we can read about interval estimates for non linear regression models?

wmurphyrd commented 7 years ago

The author of propagate has published some blog posts on the methodology:

https://www.r-bloggers.com/predictnls-part-1-monte-carlo-simulation-confidence-intervals-for-nls-models/

https://www.r-bloggers.com/predictnls-part-2-taylor-approximation-confidence-intervals-for-nls-models/

I used the Taylor approximation method from the package to create prediction intervals for the Institute of Medicine's total energy expenditure models and the actual coverage rate for the 95% PI on the source data was 96%: http://www.fasebj.org/content/30/1_Supplement/lb382.short

Note: there's an error in the published package such that it always returns CIs when using the Monte Carlo simulation, even when PI is requested. The Taylor method works correctly (and the fix for the Monte Carlo method is trivial)

jthaman commented 7 years ago

Okay, this is something I can spend some time reading. I don't have a background in these types of models, so I could take me a while. If you already have some work done on these interval estimates, it could be relatively straightforward to add them to ciTools. We recently wrote a file (https://github.com/jthaman/ciTools/blob/master/CONTRIBUTING.org) that has tips for working on this project.

tomwenseleers commented 6 years ago

Definitely interested in this too! Lifting some code from the propagate package could be the easiest...