Functions for better-than-log positive parameterization
It is common practice in statistical optimization to use log-parameterizations when a
parameter ought to be positive. i.e. if an optimization parameter
a should be non-negative then
a=exp(b) and optimize with respect to the unconstrained parameter
b. This often works
well, but it does imply a rather limited working range for
b: using 8 byte doubles, for example,
b's magnitude gets much above 700 then
a overflows or underflows. This can cause
problems for numerical optimization methods.
notExp is a monotonic function for mapping the real line into the positive real line with much less
extreme underflow and overflow behaviour than
exp. It is a piece-wise function, but is continuous
to second derivative: see the source code for the exact definition, and the example below to see what it
notLog is the inverse function of
The major use of these functions was originally to provide more robust
pdMat classes for
lme for use by
notLog2 functions are used in
their place, as a result of changes to the nlme optimization routines.
1 2 3
Argument array of real numbers (
An array of function values evaluated at the supplied argument values.
Simon N. Wood firstname.lastname@example.org
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
## Illustrate the notExp function: ## less steep than exp, but still monotonic. require(mgcv) x <- -100:100/10 op <- par(mfrow=c(2,2)) plot(x,notExp(x),type="l") lines(x,exp(x),col=2) plot(x,log(notExp(x)),type="l") lines(x,log(exp(x)),col=2) # redundancy intended x <- x/4 plot(x,notExp(x),type="l") lines(x,exp(x),col=2) plot(x,log(notExp(x)),type="l") lines(x,log(exp(x)),col=2) # redundancy intended par(op) range(notLog(notExp(x))-x) # show that inverse works!
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.