aggregate_pf: Aggregate the Performance Matrices of Multiple Interpolations

View source: R/aggregate_pf.R

aggregate_pfR Documentation

Aggregate the Performance Matrices of Multiple Interpolations

Description

Function to aggregate the set of performance matrices, by criterion, using sample statistics of the sampling distribution across K. Resulting object is of class 'aggregate_pf'.

Usage

aggregate_pf(pf, custom = NULL)

Arguments

pf

pf; A nested list of dimension D x M x P x G x K (result of performance()), where the terminal node is a performance matrix.

custom

character; A vector of names of user-defined functions used to perform aggregation with custom statistics (see details)

Details

The base statistics provided in the output are as follows:

  • (mean); mean

  • (sd); standard deviation

  • (q0); minimum (0% quantile)

  • (q2.5); 2.5% quantile

  • (q25); 25% quantile

  • (median); median (50% quantile)

  • (q75); 75% quantile

  • (q97.5); 97.5% quantile

  • (q100); maximum (100% quantile)

  • (iqr); IQR (75% quantile - 25% quantile)

  • (skewness); skewness

  • (dip); p-value of dip test for unimodality (see ?dip for details)

Users can define and pass-in their own custom statistics used for the aggregation of the performance metrics, but must adhere to the following rules:

  • Inputs are limited to *ONLY* single numeric vectors

  • Outputs must be a single numeric value

Examples


 # User-defined functions to calculate a custom aggregation statistic (see Details for rules)
 
 my_stat1 <- function(x){
  
  val <- sum(x)/length(x) + 34
  
  return(val) # return value must be a single numeric element
  
  }
  
 my_metric2 <- function(x){
 
  val <- (sum(x)-min(x))/6
 
  return(val) # return value must be a single numeric element
 
 } 
 
 # Implementing in aggregate()
 
 aggregate(pf = pf, custom = c("my_stat1", "my_stat2"))
     

castels/interpTools documentation built on June 7, 2024, 4:20 p.m.