performance: Evaluate Interpolation Performance Across Multiple Time...

View source: R/performance.R

performanceR Documentation

Evaluate Interpolation Performance Across Multiple Time Series

Description

Function to calculate the performance metrics between lists of original and interpolated series.

See additional documentation provided in this package ("~/metric_definitions.pdf/") for a full descriptions of the the performance criteria.
Resulting object is of class 'pf'.

Usage

performance(OriginalData, IntData, GappyData, custom = NULL)

Arguments

OriginalData

list; A list object of dimension D x N of original (complete) time series

IntData

list; A list object of dimension D x M x P x G x K x N of interpolated time series (output of parInterpolate())

GappyData

list; A list object of dimension D x P x G x K x N of the gappy original time series (output of simulateGaps())

custom

character; A vector of names of user-defined functions used to calculate custom performance metrics (see details)

Details

The following is a description of the list of base performance metrics included in the returned object:

ID Criterion Optimal
...... ........... .........
1 pearson_r max
2 r_squared max
3 AD min
4 MBE min
5 ME min
6 MAE min
7 MRE min
8 MARE min
9 MAPE min
10 SSE min
11 MSE min
12 RMS min
13 NMSE min
14 RE max
15 RMSE min
16 NRMSD min
17 RMSS min
18 MdAPE min

Users can define and pass-in their own custom performance metric functions, but must adhere to the following rules:

  • Inputs are limited to *ONLY* x (lowercase; the original time series) and X (uppercase; the interpolated time series)

  • Output must be a single numeric value

Examples

 # User-defined functions to calculate a custom performance metric (see Details for rules)
 
 my_metric1 <- function(x,X){
 
  # Sum of original + interpolated values
  
  val <- x + X
  
  return(val) # return value must be a single numeric element
  
  }
  
 my_metric2 <- function(x,X){
 
  # Sum of index positions of interpolated values
 
  val <- sum(which(x != X))
 
  return(val) # return value must be a single numeric element
 
 } 
 
 # Implementing in eval_performance()
 
 performance(OriginalData = OriginalData, IntData = IntData, GappyData = GappyData, custom = c("my_metric1", "my_metric2"))


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