R/cdm_penalty_threshold_scad.R

Defines functions cdm_penalty_threshold_scad

Documented in cdm_penalty_threshold_scad

## File Name: cdm_penalty_threshold_scad.R
## File Version: 0.05

cdm_penalty_threshold_scad <- function(beta, lambda, a=3.7)
{
    sign_beta <- sign(beta)
    #-- 2*lambda < abs(beta) < a*lambda
    y <- ( ( a - 1 ) * beta - sign_beta * a * lambda ) / ( a - 2 )
    #-- abs(beta) > a*lambda
    y <- ifelse( abs(beta) > a*lambda, beta, y )
    #-- abs(beta) < 2*lambda
    z <- ( abs(beta) - lambda )
    z <- ifelse( z < 0, 0, z )
    y <- ifelse( abs(beta) < 2*lambda, z*sign_beta, y )
    return(y)
}

Try the CDM package in your browser

Any scripts or data that you put into this service are public.

CDM documentation built on Aug. 25, 2022, 5:08 p.m.