R/cdm_shrink_positive.R

Defines functions cdm_shrink_positive

## File Name: cdm_shrink_positive.R
## File Version: 0.02

cdm_shrink_positive <- function(x, sum1=TRUE)
{
    y <- ifelse(x<0, 0, x)
    if (sum1){
        y <- y / sum(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.