Skip to contents

The engine_glmnet engine does not support priors in a typical sense, however it is possible to specify so called penalty factors as well as lower and upper limits on all variables in the model.

The default penalty multiplier is 1 for each coefficient X covariate, i.e. coefficients are penalized equally and then informed by an intersection of any absence information with the covariates. In contrast a variable with penalty.factor equal to 0 is not penalized at all.

In addition, it is possible to specifiy a lower and upper limit for specific coefficients, which constrain them to a certain range. By default those ranges are set to -Inf and Inf respectively, but can be reset to a specific value range by altering "lims" (see examples).

For a regularized regression that supports a few more options on the priors, check out the Bayesian engine_breg.

Usage

GLMNETPrior(variable, hyper = 0, lims = c(-Inf, Inf), ...)

# S4 method for class 'character'
GLMNETPrior(variable, hyper = 0, lims = c(-Inf, Inf), ...)

Arguments

variable

A character variable passed on to the prior object.

hyper

A numeric value between 0 and 1 that state the penalization factor. By default this is set to 0, implying the "variable" provided is not regularized at all.

lims

A numeric vector of the lower and upper limits for each coefficient (Default: c(-Inf, Inf)).

...

Variables passed on to prior object.

Examples

if (FALSE) { # \dontrun{
# Retain variable
p1 <- GLMNETPrior(variable = "forest", hyper = 0)
p1
# Smaller chance to be regularized
p2 <- GLMNETPrior(variable = "forest", hyper = 0.2, lims = c(0, Inf))
p2
} # }