Constraint which ensures that the coefficients of the specified covariates have a coherent sign.
sign_coherence(vars, big_m =100, eps =1e-06)
Arguments
vars: a character vector giving the names of the covariates the constraint should be applied to.
big_m: a double giving the big-M parameter.
eps: a double giving the epsilon used to ensure that the constraint holds.
Returns
A holistic generalized model constraint, object inheriting from class "hglmc".
Examples
dat <- rhglm(100, c(1,-2,3,4,5,6))constraints <- sign_coherence(c("x1","x3"))hglm(y ~ ., constraints = constraints, data = dat)
References
Carrizosa, E., Olivares-Nadal, A. V., & Ramírez-Cobo, P. (2020). Integer Constraints for Enhancing Interpretability in Linear Regression. SORT. Statistics and Operations Research Transactions, 44: 67-98. tools:::Rd_expr_doi("10.2436/20.8080.02.95") .