Description Usage Arguments Details Value See Also Examples
Soft L2 constraint on parameters
1  constraintL2(mu, sigma = 1, attr.name = "prior", condition = NULL)

mu 
named numeric, the prior values 
sigma 
named numeric of length of mu or numeric of length one or character of length of mu or character 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

If sigma is numeric, the function computes the constraint value
(pmu)^2/sigma^2
and its derivatives with respect to p. If sigma is a character, the function computes
(pmu)^2/sigma^2 + log(sigma^2)
and its derivatives with respect to p and sigma. Sigma parameters being
passed to the function are ALWAYS assumed to be on a log scale, i.e. internally
sigma parameters are converted by exp()
.
object of class objfn
wrss
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  mu < c(A = 0, B = 0)
sigma < c(A = 0.1, B = 1)
myfn < constraintL2(mu, sigma)
myfn(pars = c(A = 1, B = 1))
# Introduce sigma parameter but fix them (sigma parameters
# are assumed to be passed on log scale)
mu < c(A = 0, B = 0)
sigma < paste("sigma", names(mu), sep = "_")
myfn < constraintL2(mu, sigma)
pars < c(A = .8, B = .3, sigma_A = 1, sigma_B = 1)
myfn(pars = pars[c(1, 3)], fixed = pars[c(2, 4)])
# Assume same sigma parameter for both A and B
# sigma is assumed to be passed on log scale
mu < c(A = 0, B = 0)
myfn < constraintL2(mu, sigma = "sigma")
pars < c(A = .8, B = .3, sigma = 0)
myfn(pars = pars)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.