priorL2: L2 objective function for prior value

Description Usage Arguments Details Value See Also Examples

View source: R/objClass.R

Description

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

Usage

1
priorL2(mu, lambda = "lambda", attr.name = "prior", condition = NULL)

Arguments

mu

Named numeric, the prior values

lambda

Character of length one. The name of the penalty paramter in p.

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

exp(lambda)*sum((p-mu)^2)

and its derivatives with respect to p and lambda.

Value

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

See Also

wrss

Examples

1
2
3
4
p <- c(A = 1, B = 2, C = 3, lambda = 0)
mu <- c(A = 0, B = 0)
obj <- priorL2(mu = mu, lambda = "lambda")
obj(pars = p + rnorm(length(p), 0, .1))

dMod documentation built on Jan. 27, 2021, 1:07 a.m.