Open jzwart opened 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.
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 .
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)?
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.
Can we create uncertainty estimates using Hessian matrix? or another way from the optimization algorithm?
A slower approach is to add a bootstrapping function.