Skip to contents

Ensures a value remains above a small threshold using a smooth approximation and penalty. See https://github.com/kaskr/adcomp/issues/7 for discussion.

Usage

posfun(x, eps = 0.001)

Arguments

x

A numeric value or vector to constrain.

eps

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

Value

A list with components:

new

Numeric value or vector of transformed values that remain above eps.

penalty

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