Nonlinear optimization problems often have different scale for different parameters. This function is intended to explore the differences in scale. It is, however, an imperfect and heuristic tool, and could be improved.

At this time scalecheck does NOT take account of masks. (?? should 110702)

1 | ```
scalecheck(par, lower = lower, upper = upper, bdmsk=NULL, dowarn = TRUE)
``` |

`par` |
A numeric vector of starting values of the optimization function parameters. |

`lower` |
A vector of lower bounds on the parameters. |

`upper` |
A vector of upper bounds on the parameters. |

`bdmsk` |
An indicator vector, having 1 for each parameter that is "free" or unconstrained, and 0 for any parameter that is fixed or MASKED for the duration of the optimization. |

`dowarn` |
Set TRUE to issue warnings. Othwerwise this is a silent routine. Default TRUE. |

The scalecheck function will check that the bounds exist and are admissible, that is, that there are no lower bounds that exceed upper bounds.

NOTE: Free paramters outside bounds are adjusted to the nearest bound. We then set parchanged = TRUE which implies the original parameters were infeasible.

There is a check if lower and upper bounds are very close together, in which case a mask is imposed and maskadded is set TRUE. NOTE: it is generally a VERY BAD IDEA to have bounds close together in optimization, but here we use a tolerance based on the double precision machine epsilon. Thus it is not a good idea to rely on scalecheck() to test if bounds constraints are well-posed.

A list with components:

# Returns: # list(lpratio, lbratio) – the log of the ratio of largest to smallest parameters # and bounds intervals (upper-lower) in absolute value (ignoring Inf, NULL, NA)

`lpratio` |
The log of the ratio of largest to smallest parameters in absolute value (ignoring Inf, NULL, NA) |

`lbration` |
The log of the ratio of largest to smallest bounds intervals (upper-lower) in absolute value (ignoring Inf, NULL, NA) |

1 | ```
#####################
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.