Skip to contents

Soft Cauchy Constraint on Parameters

Usage

constraintCauchy(mu, sigma = 1, attrName = "prior", condition = NULL)

Arguments

mu

Named numeric vector of prior locations. The names select the constrained parameters.

sigma

Numeric, scalar or named and aligned with mu, default 1. The Cauchy scale.

attrName

Character. Name of the attribute holding the constraint value, default "prior".

condition

Character vector, the conditions of a sum of objectives in which the term is evaluated. NULL (default) evaluates it in every one.

Value

An objective function of class objfn, called as obj(pars, ...), see dModfn. The objective value is the full -2 log density.

Details

Computes the Cauchy prior on the -2 log scale, $$2\log(\pi\sigma) + 2\log(1 + ((p-\mu)/\sigma)^2).$$ The heavy tails make it the tolerant alternative to constraintL2: a parameter far from mu is pulled far more weakly than a Gaussian would pull it.

Examples

prior <- constraintCauchy(mu = c(k1 = 0), sigma = 2)
prior(pars = c(k1 = 1))$value
#> [1] 4.122041