#' @title Statistic confidence
#'
#' @description Statistical confidence for each hazard classes. Confidence threshold : 1.64 (95% confidence).
#'
#' @param df_postprob_freq postprob frequency data frame (from build_df_postprobfreq function)
#' @param seuils thresholds of hazard classes, default are jtc1
#'
#' @return a data frame with the statistical confidence for each hasard class
#'
#' @import dplyr
#' @export
conf_stat <- function(df_postprob_freq, seuils = jtc1_threshold){
df_reclass <- add_hasard_classes(df_postprob_freq, seuils = seuils)
colnames(seuils) <- c("lower", "upper", "hazard_class")
tmp <- df_reclass %>%
group_by(hazard_class) %>%
summarise(ncell = sum(COUNT))
tmp2 <- df_reclass %>%
filter(CONF > 1.64) %>%
group_by(hazard_class) %>%
summarise(ncell_sup95 = sum(COUNT))
df_confstat <- seuils %>%
left_join(tmp) %>%
left_join(tmp2) %>%
mutate(prct_sup95 = ncell_sup95/ncell*100)
return(df_confstat)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.