visualize.loss {grpnet} | R Documentation |
Plots grpnet Loss Function on Link or Response Scale
Description
Makes a plot or returns a data frame containing the specified loss function evaluated at a sequence of input values.
Usage
visualize.loss(x = seq(-3, 3, length.out = 1001),
family = c("gaussian", "multigaussian",
"svm1", "svm2", "logit",
"binomial", "multinomial",
"poisson", "negative.binomial",
"Gamma", "inverse.gaussian"),
theta = 1,
type = c("link", "response"),
y = NULL,
plot = TRUE,
add = FALSE,
...)
Arguments
x |
sequence of linear predictor values at which to evaluate the loss. |
family |
Character specifying the assumed distribution for the response variable. Partial matching is allowed. See options below. |
theta |
For SVM1: additional ("smoothing") parameter, that controls the smoothing rate of the hinge loss function.
For negative binomial: additional ("size") parameter, where the variance function is defined as |
type |
Default of |
y |
Response value used to compute loss. Note that the loss function is interpreted as a function of |
plot |
if |
add |
if |
... |
additional arguments passed to |
Details
grpnet implements the following loss functions:
- gaussian/multigaussian
L = (y - \mu)^2
- svm1
L = \left\{ \begin{array}{ll} \frac{1}{2\theta}(1 - \mu y)_{+}^2 & 1 - \theta < \mu y \\ 1 - \mu y - \theta / 2 & \mu y \leq 1 - \theta \end{array} \right.
- svm2
L = (1 - \mu y)_{+}^2
- logit
L = \log(1 + \exp(-\mu y))
- binomial
L = -y\log(\mu) - (1-y) \log(1-\mu)
- multinomial
L = -\sum_{l=1}^m I(y=l) \log(\mu_l)
- poisson
L = \mu - y \log(\mu)
- negative.binomial
L =
(\theta + y) \log(\theta + \mu) - y \log(\mu) + c
wherec = \log(\Gamma(\theta)) - \log(\Gamma(\theta + y)) - \theta \log(\theta)
is a constant with respect to\mu
- Gamma
L = \log(\mu) + y / \mu
- inverse.gaussian
L = (y - \mu)^2 / (\mu^2 y)
Value
If plot = TRUE
, a plot is produced and nothing is returned.
If plot = FALSE
, a data frame is returned with columns:
eta |
linear predictor, i.e., fitted values on link scale (same as input |
mu |
expected value, i.e., fitted values on response scale ( |
loss |
loss function evaluation for given |
Author(s)
Nathaniel E. Helwig <helwig@umn.edu>
References
Helwig, N. E. (2025). Versatile descent algorithms for group regularization and variable selection in generalized linear models. Journal of Computational and Graphical Statistics, 34(1), 239-252. doi:10.1080/10618600.2024.2362232
See Also
visualize.penalty
for plotting penalty function
visualize.shrink
for plotting shrinkage operator
Examples
visualize.loss(family = "gaussian")
visualize.loss(family = "svm1", theta = 0.1)
visualize.loss(family = "svm2")
visualize.loss(family = "logit")
visualize.loss(family = "binomial")
visualize.loss(family = "poisson")
visualize.loss(family = "negative.binomial", theta = 10)
visualize.loss(family = "Gamma")
visualize.loss(family = "inverse.gaussian")