bbolker / bbolker/testing_bias_distribution
debugging OR sims
- Dominant language
- HTML
- Stars
- 2
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
A few general remarks:
* I'm not entirely sure why this optimization problem is so hard, but I'm suspecting because it's poorly constrained - that is, because it's not too hard to get impossible outcomes by setting the parameters (in)appropriately
* in general, returning NA or 'squashing' parameters to legal values (e.g. `prevalence = pmin(prevalence, pop_size)`) doesn't work optimally, because once the parameters go out of bounds there is no gradient to guide them back to the legal space (one can add a penalty that it (say) a quadratic function of the distance from the edge of the 'legal' space, but that's harder). It's better to constrain the parameters to the legal space *or* transform to an unconstrained space
* I changed from fitting `B` and `Phi` to `log(B)` and `log(Phi)` (this is different from assuming that something varies linearly on the odds vs the log-odds space - approximately equivalent to fitting with constraints B > 0 and Phi >0)
* the Hessian computation is unstable, for reasons I don't completely understanding. `mle2` uses `numDeriv::hessian()` internally rather than `optimHess`, which I thought would usually be slower but more reliable, but in this case `optimHess` works better. There isn't currently an `mle2` option for changing methods internally (I could add one), but I've added a function for re-computing the Hessian with `optimHess` and substituting the corresponding covariance matrix in the fit ...
* I'm no longer getting the error about `Re(ev)` - I could adjust `mle2` [here](https://github.com/bbolker/bbmle/blob/master/R/mle.R#L560-L565) to make it more robust if necessary ...
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the optimization and Hessian behavior described with mle2, numDeriv::hessian(), and optimHess. The linked target is R/mle.R lines 560-565, but the issue gives no concrete acceptance criteria; clarify whether the goal is parameter constraints, Hessian substitution, or Re(ev) robustness before defining done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- analytics, data
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100