Last data update: 2014.03.03

R: Soft L2 constraint on parameters
constraintL2R Documentation

Soft L2 constraint on parameters

Description

Soft L2 constraint on parameters

Usage

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

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

Results