Learn R Programming

dMod (version 0.3.2)

constraintL2: 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.

Value

object of class objfn

Details

Computes the constraint value $$\left(\frac{p-\mu}{\sigma}\right)^2$$ and its derivatives with respect to p.

See Also

wrss

Examples

Run this code
# NOT RUN {
mu <- c(A = 0, B = 0)
sigma <- c(A = 0.1, B = 1)
myfn <- constraintL2(mu, sigma)
myfn(pars = c(A = 1, B = -1))
# }

Run the code above in your browser using DataLab