Skip to contents

Leaves values at or above a threshold unchanged and replaces smaller values with a strictly positive continuation while returning a quadratic penalty. See https://github.com/kaskr/adcomp/issues/7 for discussion.

Usage

posfun(x, eps = 0.001)

Arguments

x

A numeric or RTMB automatic-differentiation vector to constrain.

eps

A numeric value specifying the minimum allowable value (default 0.001).

Value

A list with components:

new

Values at or above eps unchanged, with smaller values replaced by a strictly positive continuation.

penalty

Numeric value or vector of penalties applied when x < eps.