Soft L2 constraint on parameters

Description

Soft L2 constraint on parameters

Usage

1
constraintL2(mu, sigma = 1, attr.name = "prior", condition = NULL)

Arguments

mu

named numeric, the prior values

sigma

named numeric of length of mu or numeric of length one.

attr.name

character. The constraint value is additionally returned in an attributed with this name

condition

character, the condition for which the constraint should apply. If NULL, applies to any condition.

Details

Computes the constraint value

(p-mu)^2/sigma^2

and its derivatives with respect to p.

Value

object of class objfn

See Also

wrss

Examples

1
2
3
4
mu <- c(A = 0, B = 0)
sigma <- c(A = 0.1, B = 1)
myfn <- constraintL2(mu, sigma)
myfn(pars = c(A = 1, B = -1))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.