GLEON / LakeMetabolizer

Collection of Lake Metabolism Functions
16 stars 10 forks source link

Add estimates of uncertainty to metab.mle and metab.kalman #71

Open jzwart opened 9 years ago

jzwart commented 9 years ago

Can we create uncertainty estimates using Hessian matrix? or another way from the optimization algorithm?

A slower approach is to add a bootstrapping function.

lawinslow commented 9 years ago

I think this could be done. One challenge is adding that while keeping output consistent across models that cannot estimate uncertainty (Bookkeeping). Just something to think about.

rBatt commented 9 years ago

Bookkeeping can't get it

For least squares, we can get it from the parameter s.e.'s. On this line [ https://github.com/GLEON/LakeMetabolizer/blob/master/R/metab.ols.R#L101], you can see we almost added the lm model as an attribute. That's a lot of info b/c it's per-day. However, we just add the s.e.'s

For mle and kalman we get it from the Hessian

For Bayesian we get it from the posterior. As a matter of fact, for metab.bayesian(), the uncertainty estimates are already supplied.

We can add the s.e.'s as an attribute.

PROBLEM: Pending Jake's other question, I think part of the solution might prohibit blanket provision of s.e.'s via Hessian. This is b/c my solution to Jake's other question ultimately relies on giving the user the option to have more control over the optimization (supply own function, set parameters to optim() or other function). Not all other methods can yield a Hessian the way, say, Nelder Mead can.

On Tue, Nov 18, 2014 at 7:35 PM, Luke Winslow notifications@github.com wrote:

I think this could be done. One challenge is adding that while keeping output consistent across models that cannot estimate uncertainty (Bookkeeping). Just something to think about.

— Reply to this email directly or view it on GitHub https://github.com/GLEON/LakeMetabolizer/issues/71#issuecomment-63572993 .

jzwart commented 9 years ago

Hmmm.... could there just be thorough documentation on what is required to get a Hessian (i.e. if the user wanted to mess around with the optim method)?

jzwart commented 9 years ago

Also I thought I read somewhere that it's not good to use Hessian matrix if residuals are autocorrelated, which may be the case for some metab days, but @rBatt you probably know better than me.