rankModels: Calculate age-specific and overall model rank.

Usage Arguments Value Examples

View source: R/Module_rankModels.R

Usage

1
rankModels(dat, columnToRank = NULL, relative.bol = FALSE)

Arguments

dat

An array. The retro function produces a list of arrays, any of those arrays can be used at the dat argument. Column names define each of the performance metrics, row names define the models. Performance metrics can include: "MRE", "MAE", "MPE", "MAPE", "MASE", "RMSE".

columnToRank

A character or integer vector. Values represent the index or names of columns to be ranked. If NA (the default) then all columns are ranked.

relative.bol

A Boolean. FALSE means use ordinal ranking (i.e. first, second, third,...). TRUE will use scaled ranking. Default is FALSE. Look to Details for additional information.

Value

A list of data frames. Each data frame represents the results of each age class (i.e. the third dimension of the input array). with ranking by performance metric and overall average.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
dat.rank <- apply(dat.arr, 3, function(x){
  #input to ranking must be a data frame
  dat <- as.data.frame(x)
  #if argument columnToRank is left as NA (default) then all columns are used in ranking
  dat.rank <- getRanks(dat)
  return(dat.rank)
  })

  str(dat.rank)

  #rank by column name
  rankModels(dat.arr[,,1], columnToRank = "MRE")
  #rank by column index
  rankModels(dat.arr[,,1], columnToRank = 1)

## End(Not run)

MichaelFolkes/forecastR_package documentation built on April 4, 2021, 5:14 a.m.