Skip to content

debugging OR sims #2

Description

@bbolker

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 to make it more robust if necessary ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions