Learn R Programming

stsm (version 1.7)

barrier.eval: Barrier Term in the Likelihood Function

Description

This function evaluates a barrier term to be added to the log-likelihood function in order to penalize for parameter values close to the boundaries.

Usage

barrier.eval(model, type = c("1", "2"), mu = 0.01, 
  gradient = FALSE, hessian = FALSE)

Arguments

model
object of class stsm.
type
a character indicating the type of barrier term.
mu
the barrier multiplier. A positive value.
gradient
logical. If TRUE, the first order derivatives of the barrier term with respect to the parameters of the model are evaluated.
hessian
logical. If TRUE, the second order derivatives of the barrier term with respect to the parameters of the model are evaluated.

Value

  • A list containing the barrier term evaluated for the lower and upper bound constraints, bl and bu, respectively, and the first and second order derivatives of the barrier term, dl1, du1, dl2, du2.

Details

A barrier term can be defined in order to penalize against parameter values close to the boundaries defined in model@lower and model@upper. The barrier term is added to the negative of the log-likelihood function, which is then given by:

$$-logLik + \mu \sum_i q_i(x).$$

$\mu$ is a positive barrier multiplier, the larger it is the stronger the barrier is and, hence, the search is done farther from the boundaries (Rardin, 1998 Fig. 14.8); $q_i(x)$ are the barrier functions that are defined in such a way that the barrier term grows to infinity as the parameters of the model approach to the boundaries. Two types of barrier functions are considered:

[object Object],[object Object],[object Object],[object Object]

References

Rardin, R.L. (1998). Section 14.5. Optimization in Operations Research. Prentice Hall.

See Also

mloglik.fd, mloglik.td.

Examples

Run this code
# define local level plus seasonal model for a simulated time series
# and evaluate the barrier term for some parameter values
# the barrier term in the second model is higher since the variances 
# are closer to the lower bounds (zero)
data("llmseas")
pars <- c("var1" = 30, "var2" = 1, "var3" = 10)
m1 <- stsm.model(model = "llm+seas", y = llmseas, pars = pars)
bar1 <- barrier.eval(m1, type = "2", mu = 3)
bar1$barrier

pars <- c("var1" = 0.3, "var2" = 0.01, "var3" = 0.1)
m2 <- stsm.model(model = "llm+seas", y = llmseas, pars = pars)
bar2 <- barrier.eval(m2, type = "2", mu = 3)
bar2$barrier

# the barrier term is added to the negative of the likelihood function
# that will be the objective function to be minimized,
# value of minus log-likelihood without barrier
mloglik.fd(model = m2)
# adding a barrier term
mloglik.fd(model = m2) + bar2$barrier
mloglik.fd(model = m2, barrier = list(type = "2", mu = 3))

Run the code above in your browser using DataLab