COMPASS-DOE / grossMethane

analysis code for paired data sets of laboratory-incubations of gross methane flux and associated field net methane and CO2 flux rates
1 stars 1 forks source link

Optimizer can't find good solutions for some samples #18

Closed bpbond closed 1 year ago

bpbond commented 1 year ago

As noted in the just-closed #14 , right now the optimizer fits total methane (m) well, but for a subset can't replicate labeled methane (n). These samples share some characteristics:

193429400-f58d1569-f0b2-48ce-8563-3528130116a8

...such as high initial 12CH4 and 13CH4 and crucially—it seems like—AP that doesn't drop very fast or at all.

The big question, I think: what next. Do we

bpbond commented 1 year ago

Also, it seems like optim can't find good solutions if the numerical values are very small, so we ended up changing from ml/day to µl/day:

https://github.com/COMPASS-DOE/grossMethane/blob/8bbfc1bfde157a63b0cb1aad00e7cf3842768e30/not-a-toy.R#L57-L58

This needs to be documented.

kendalynnm commented 1 year ago

Possible issue with gradient vs line function?

https://stat.ethz.ch/pipermail/r-help/2007-February/126209.html

https://stackoverflow.com/questions/11387330/errors-when-attempting-constrained-optimisation-using-optim

$convergence [1] 52

$message [1] "ERROR: ABNORMAL_TERMINATION_IN_LNSRCH"

image

bpbond commented 1 year ago

"You can try with other optimizers (complete list on the optimization task view), until you find one for which the optimization converges."

Let's discuss.

bpbond commented 1 year ago

Seems like this is now occurring for lots of samples.

kendalynnm commented 1 year ago

Seems like this is now occurring for lots of samples.

Hmm...I'm getting the same results after pulling the most recent versions. There are many samples with good fits that generate the error message, is that what you reference here?

bpbond commented 1 year ago

Yes, that's what I'm seeing too. I agree, though—the fits are good.

kendalynnm commented 1 year ago

This issue was resolved by correctly implementing the cost function, see PoolDilutionR ?pdr_cost()