Learn R Programming

dMod (version 0.1)

constraintL2: Soft L2 constraint on parameters

Description

Soft L2 constraint on parameters

Usage

constraintL2(p, mu, sigma = 1, fixed = NULL)

Arguments

p
Namec numeric, the parameter value
mu
Named numeric, the prior values
sigma
Named numeric of length of mu or numeric of length one.
fixed
Named numeric with fixed parameter values (contribute to the prior value but not to gradient and Hessian)

Value

  • List of class obj, i.e. objective value, gradient and Hessian as list.

Details

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

See Also

wrss

Examples

Run this code
p <- c(A = 1, B = 2, C = 3)
mu <- c(A = 0, B = 0)
sigma <- c(A = 0.1, B = 1)
constraintL2(p, mu, sigma)

Run the code above in your browser using DataLab