R/RcppExports.R

Defines functions roc fcprob rankHistogram sort_members ecoval

Documented in ecoval fcprob rankHistogram roc sort_members

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Compute economic value score
#'
#' @param obs A vector observations (value 0,1)
#' @param pred A vector of probabilities [0,1].
#' @param costloss A vector of cost/loss ratios
#' @param thresholds A vector of threshold probabilities
#' @value a list of cl, value, Vmax, Venv, H, F, s, n
ecoval <- function(obs, pred, costloss, thresholds) {
    .Call('_harpPoint_ecoval', PACKAGE = 'harpPoint', obs, pred, costloss, thresholds)
}

#' Sort a 2d array.
#'
#' @param x A two dimensional numeric array.
#' @param byrow Set to true sort rows, false to sort columns.
sort_members <- function(x, byrow = TRUE) {
    .Call('_harpPoint_sort_members', PACKAGE = 'harpPoint', x, byrow)
}

#' Compute the rank histogram for an EPS
#'
#' @param obs A vector of observations.
#' @param fc A two dimensional array of EPS data with members in columns.
rankHistogram <- function(obs, fc) {
    .Call('_harpPoint_rankHistogram', PACKAGE = 'harpPoint', obs, fc)
}

#' Compute the forecast probabilities for given thresholds
#'
#' @param fc A two dimensional array of EPS data with members in columns.
#' @param byrow The thresholds to compute probabilities for
fcprob <- function(fc, thresholds) {
    .Call('_harpPoint_fcprob', PACKAGE = 'harpPoint', fc, thresholds)
}

#' Compute ROC and area under ROC
#'
#' @param obs A vector observations (value 0,1)
#' @param pred A vector of probabilities [0,1].
#' @param thresholds A vector of threshold probabilities
#' @value a list with area and vectors thresholds, H, F
roc <- function(obs, pred, thresholds) {
    .Call('_harpPoint_roc', PACKAGE = 'harpPoint', obs, pred, thresholds)
}
andrew-MET/harpPoint documentation built on Feb. 23, 2023, 1:06 a.m.