p.constrain: Transform data between unconstrained and box box-constrained scale
Description
These functions can be used to transform a vector of data or parameters
between unconstrained [-Inf, Inf] and box-constrained representation
(interval [lower, upper]).
Usage
p.constrain(p, lower = -Inf, upper = Inf, f = 1)
p.unconstrain(p, lower = -Inf, upper = Inf, f = 1)
Arguments
p
vector of data (e.g. model parameters),
lower, upper
vectors with lower resp. upper bounds used for
transformation,
f
optional scaling factor.
Value
vector with transformed (resp. back-transformed) values.
Details
These functions are employed by fitOdeModellink{ssqOdeModel}
in order to be able to use the unconstrained optimizers of optim for
constrained optimization.
The transformation functions are
$$p' = \tan(\pi/2 \cdot (2 p - upper - lower) / (upper - lower)) \cdot 1/f$$
and its inverse
$$p = (upper + lower)/2 + (upper - lower) \cdot \arctan(f \cdot p')/\pi$$.
References
Reichert, T. (1998) AQUASIM 2.0 User Manual.
Computer Program for the Identification and Simulation
of Aquatic Systems. Swiss Federal Institute for Environmental Science
and Technology (EAWAG), CH - 8600 Duebendorf Switzerland,
http://www.aquasim.eawag.ch/e_aquasim_manual.html