4
$\begingroup$

Is it possible that all the parameters of a generalized linear model are constrained to be non-negative? If so, when? Any examples?

$\endgroup$
0

2 Answers 2

2
$\begingroup$

Well, it is certainly possible, but mostly only some coefficients will be restricted. A glm (generalized linear model) have a linear predictor $\eta(x)=\beta^T x$ and the parameter vector $\beta$ then plays the same role as in linear regression, so restrictions can apply in the same way as with linear regression.

An example is Linear model with constraints on coefficients in terms of ratios, although the method used there with a glm would lead to a nested optimization. Another example is Looking for function to fit sigmoid-like curve, where a monotone spline is fit, which could also be combined with a glm. The non-negativity restrictions there is used to impose monotone increasing, if the same coefficients had been required to be nonpositive the result would have been monotone decreasing.

This last example is an example of shape-restricted splines, there is now an R package (actually multiple) implementing those ideas. cgam implements them in the setting of gam's (generalized additive models), a generalization of glm's. An example from that package's helpfile is:

library(cgam)
data(kyphosis, package="gam")

# regress Kyphosis on Age, Number, and Start under the restrictions:
# "concave", "increasing and concave", and "decreasing and concave"

fit <- cgam(Kyphosis ~ conc(Age) + incr.conc(Number) + decr.conc(Start), 
       family = binomial(), data = kyphosis) 
$\endgroup$
4
  • 2
    $\begingroup$ I encounter problems where all coefficients are positive in the case when the linear model represents some physical reality where all coefficients are necessarily positive. For instance, if you are mixing different components together, then you can only add but not subtract, $\endgroup$ Nov 6, 2020 at 17:03
  • $\begingroup$ This is a very weird deja-vu. I do not remember having written that comment yesterday. But I do remember having written it a long time ago. @kjetil do you remember this comment showing up earlier on your post? $\endgroup$ Nov 8, 2020 at 8:29
  • $\begingroup$ @Sextus Empiricus: I remember it appearing yesterday---can software count wrong? (maybe we soon will see some US court discussion ...) $\endgroup$ Nov 8, 2020 at 9:58
  • $\begingroup$ Maybe I am confused with this question stats.stackexchange.com/questions/212138 ... But I still can't remember writing that comment. $\endgroup$ Nov 8, 2020 at 11:37
2
$\begingroup$

You can fit GLMs with nonnegativity constraints on the fitted coefficients using the glm.cons function in the zetadiv package : https://rdrr.io/cran/zetadiv/man/glm.cons.html (the p values and confidence intervals are not calculated correctly though - there is no correct closed form solution for them under nonnegativity constraints; bootstrapping would be the way to go). If you would like only some coefficients to have nonnegativity constraints you can use https://cran.r-project.org/web/packages/restriktor/index.html. Or there is the glmnet package, which fits GLMs with LASSO or elastic net regularization, where you have the options lower.limits and upper.limits with which you can specify box constraints. Finally, to fit nonnegative Poisson, binomial and negative binomial GLMs there is http://finzi.psych.upenn.edu/R/library/addreg/html/00Index.html.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.