R/rFP.p100.R

Defines functions rFP.p100

Documented in rFP.p100

#' Calculate reduction in false positive count
#'
#' @param x result of dca() function
#'
#' @return a dataframe contains thresholds, rFP.100: reduction
#'     in false positive count per 100 patients.
#' @export
#'
rFP.p100 <- function(x){
    model.all = levels(x$model)
    for(i in 1:length(model.all)){
        if (i==1) df=NULL
        model=model.all[i]
        thresholds = (x$thresholds)[x$model==model.all]
        NB.medel=(x$NB)[x$model==model.all]
        NB.all=(x$NB)[x$model=='All' & x$thresholds %in% thresholds]
        advantage=NB.medel-NB.all
        rFP.p100=advantage*100/(thresholds/(1-thresholds))
        dfi=data.frame(thresholds,rFP.p100,model=model)
        df=rbind(df,dfi)
    }
    class(df)=c('rFP.p100','data.frame')
    df
}

Try the ggDCA package in your browser

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

ggDCA documentation built on Sept. 6, 2020, 5:06 p.m.