compute_derivative: Penalty Derivative Computation

View source: R/compute_derivative.R

compute_derivativeR Documentation

Penalty Derivative Computation

Description

Compute one or more derivative values for a given omega, allowing vectorized specifications of penalty, lambda, and gamma.

Usage

compute_derivative(omega, penalty, lambda, gamma = NA)

Arguments

omega

A numeric value or vector at which the penalty is evaluated.

penalty

A character string or vector specifying one or more penalty types. Available options include:

  1. "lasso": Least absolute shrinkage and selection operator \insertCitetibshirani1996regression,friedman2008sparsegrasps.

  2. "atan": Arctangent type penalty \insertCitewang2016variablegrasps.

  3. "exp": Exponential type penalty \insertCitewang2018variablegrasps.

  4. "lq": Lq penalty \insertCitefrank1993statistical,fu1998penalized,fan2001variablegrasps.

  5. "lsp": Log-sum penalty \insertCitecandes2008enhancinggrasps.

  6. "mcp": Minimax concave penalty \insertCitezhang2010nearlygrasps.

  7. "scad": Smoothly clipped absolute deviation \insertCitefan2001variable,fan2009networkgrasps.

If penalty has length 1, it is recycled to the common length determined by penalty, lambda, and gamma.

lambda

A non-negative numeric value or vector specifying the regularization parameter. If lambda has length 1, it is recycled to the common length determined by penalty, lambda, and gamma.

gamma

A numeric value or vector specifying the additional parameter for the penalty function. If lambda has length 1, it is recycled to the common length determined by penalty, lambda, and gamma. The penalty-specific defaults are:

  1. "atan": 0.005

  2. "exp": 0.01

  3. "lq": 0.5

  4. "lsp": 0.1

  5. "mcp": 3

  6. "scad": 3.7

For "lasso", gamma is ignored.

Value

A data frame with S3 class "derivative" containing:

omega

The input omega values.

penalty

The penalty type for each row.

lambda

The regularization parameter used.

gamma

The additional penalty parameter used.

value

The computed derivative value.

The number of rows equals max(length(penalty), length(lambda), length(gamma)). Any of penalty, lambda, or gamma with length 1 is recycled to this common length.

References

\insertAllCited

Examples

library(grasps)
library(ggplot2)

deriv_df <- compute_derivative(
  omega = seq(0, 4, by = 0.01),
  penalty = c("atan", "exp", "lasso", "lq", "lsp", "mcp", "scad"),
  lambda = 1)

plot(deriv_df) +
  scale_y_continuous(limits = c(0, 1.5)) +
  guides(color = guide_legend(nrow = 2, byrow = TRUE))

grasps documentation built on Nov. 28, 2025, 1:06 a.m.