Learn R Programming

dMod (version 0.1)

priorL2: L2 objective function for prior value

Description

As a prior function, it returns derivatives with respect to the penalty parameter in addition to parameter derivatives.

Usage

priorL2(p, mu, lambda = "lambda", fixed = NULL)

Arguments

p
Namec numeric, the parameter value
mu
Named numeric, the prior values
lambda
Character of length one. The name of the penalty paramter in p.
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 $$\lambda \| p-\mu \|^2$$ and its derivatives with respect to p and lambda.

See Also

wrss, constraintExp2

Examples

Run this code
p <- c(A = 1, B = 2, C = 3, lambda = 1)
mu <- c(A = 0, B = 0)
priorL2(p, mu, lambda = "lambda")

Run the code above in your browser using DataLab