From 63753e0a88a3768220a3c49d1cb67ac9e4ce8f09 Mon Sep 17 00:00:00 2001 From: Nadia Milders Date: Thu, 29 Feb 2024 15:59:27 +0100 Subject: [PATCH 1/4] Including parameter return_means --- R/CRPS.R | 30 ++++++++++++++---------- R/RPS.R | 70 ++++++++++++++++++++++++++++++-------------------------- 2 files changed, 56 insertions(+), 44 deletions(-) diff --git a/R/CRPS.R b/R/CRPS.R index 6524bee..c126462 100644 --- a/R/CRPS.R +++ b/R/CRPS.R @@ -25,6 +25,9 @@ #'@param Fair A logical indicating whether to compute the FairCRPS (the #' potential CRPS that the forecast would have with an infinite ensemble size). #' The default value is FALSE. +#'@return_mean A logical idicating whether to return the temporal mean of CRPS +#' or not. When TRUE the temporal mean is calculated, when FALSE the time +#' dimension is not aggregated. The default is TRUE. #'@param ncores An integer indicating the number of cores to use for parallel #' computation. The default value is NULL. #' @@ -47,7 +50,7 @@ #'@importFrom ClimProjDiags Subset #'@export CRPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', dat_dim = NULL, - Fair = FALSE, ncores = NULL) { + Fair = FALSE, return_mean = TRUE, ncores = NULL) { # Check inputs ## exp and obs (1) if (!is.array(exp) | !is.numeric(exp)) @@ -86,7 +89,7 @@ CRPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', dat_dim = NU if (identical(as.numeric(dim(obs)[memb_dim]), 1)) { obs <- ClimProjDiags::Subset(x = obs, along = memb_dim, indices = 1, drop = 'selected') } else { - stop("Not implemented for observations with members ", + stop("Not implemented for observations with members ", "('obs' can have 'memb_dim', but it should be of length = 1).") } } @@ -124,8 +127,11 @@ CRPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', dat_dim = NU Fair = Fair, ncores = ncores)$output1 - # Return only the mean CRPS - crps <- MeanDims(crps, time_dim, na.rm = FALSE) + if (isTRUE(return_mean)) { + crps <- MeanDims(crps, time_dim, na.rm = FALSE) + } else { + crps <- crps + } return(crps) } @@ -134,7 +140,7 @@ CRPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', dat_dim = NU Fair = FALSE) { # exp: [sdate, memb, (dat_dim)] # obs: [sdate, (dat_dim)] - + # Adjust dimensions if needed if (is.null(dat_dim)) { nexp <- 1 @@ -145,28 +151,28 @@ CRPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', dat_dim = NU nexp <- as.numeric(dim(exp)[dat_dim]) nobs <- as.numeric(dim(obs)[dat_dim]) } - + # for FairCRPS R_new <- ifelse(Fair, Inf, NA) - + CRPS <- array(dim = c(dim(exp)[time_dim], nexp = nexp, nobs = nobs)) - + for (i in 1:nexp) { for (j in 1:nobs) { exp_data <- exp[, , i] obs_data <- obs[, j] - + if (is.null(dim(exp_data))) dim(exp_data) <- c(dim(exp)[1:2]) if (is.null(dim(obs_data))) dim(obs_data) <- c(dim(obs)[1]) - + crps <- SpecsVerification::enscrps_cpp(ens = exp_data, obs = obs_data, R_new = R_new) CRPS[, i, j] <- crps } } - + if (is.null(dat_dim)) { dim(CRPS) <- c(dim(CRPS)[time_dim]) } - + return(CRPS) } diff --git a/R/RPS.R b/R/RPS.R index 29f9bc3..e7e33fa 100644 --- a/R/RPS.R +++ b/R/RPS.R @@ -52,6 +52,9 @@ #'@param cross.val A logical indicating whether to compute the thresholds #' between probabilistic categories in cross-validation. The default value is #' FALSE. +#'@return_mean A logical idicating whether to return the temporal mean of CRPS +#' or not. When TRUE the temporal mean is calculated, when FALSE the time +#' dimension is not aggregated. The default is TRUE. #'@param na.rm A logical or numeric value between 0 and 1. If it is numeric, it #' means the lower limit for the fraction of the non-NA values. 1 is equal to #' FALSE (no NA is acceptable), 0 is equal to TRUE (all NAs are acceptable). @@ -85,7 +88,8 @@ #'@export RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NULL, dat_dim = NULL, prob_thresholds = c(1/3, 2/3), indices_for_clim = NULL, - Fair = FALSE, weights = NULL, cross.val = FALSE, na.rm = FALSE, ncores = NULL) { + Fair = FALSE, weights = NULL, cross.val = FALSE, return_mean = TRUE, + na.rm = FALSE, ncores = NULL) { # Check inputs ## exp and obs (1) @@ -150,8 +154,8 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL } if (!identical(length(name_exp), length(name_obs)) | !identical(dim(exp)[name_exp], dim(obs)[name_obs])) { - stop("Parameter 'exp' and 'obs' must have same length of ", - "all dimensions except 'memb_dim' and 'dat_dim'.") + stop(paste0("Parameter 'exp' and 'obs' must have same length of ", + "all dimensions except 'memb_dim' and 'dat_dim'.")) } ## prob_thresholds if (!is.numeric(prob_thresholds) | !is.vector(prob_thresholds) | @@ -160,7 +164,7 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL } ## indices_for_clim if (is.null(indices_for_clim)) { - indices_for_clim <- seq_len(dim(obs)[time_dim]) + indices_for_clim <- 1:dim(obs)[time_dim] } else { if (!is.numeric(indices_for_clim) | !is.vector(indices_for_clim)) { stop("Parameter 'indices_for_clim' must be NULL or a numeric vector.") @@ -183,18 +187,18 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL if (!is.array(weights) | !is.numeric(weights)) stop("Parameter 'weights' must be a named numeric array.") if (is.null(dat_dim)) { - if (length(dim(weights)) != 2 | !all(names(dim(weights)) %in% c(memb_dim, time_dim))) + if (length(dim(weights)) != 2 | any(!names(dim(weights)) %in% c(memb_dim, time_dim))) stop("Parameter 'weights' must have two dimensions with the names of ", "'memb_dim' and 'time_dim'.") if (dim(weights)[memb_dim] != dim(exp)[memb_dim] | dim(weights)[time_dim] != dim(exp)[time_dim]) { - stop("Parameter 'weights' must have the same dimension lengths ", - "as 'memb_dim' and 'time_dim' in 'exp'.") + stop(paste0("Parameter 'weights' must have the same dimension lengths ", + "as 'memb_dim' and 'time_dim' in 'exp'.")) } weights <- Reorder(weights, c(time_dim, memb_dim)) - + } else { - if (length(dim(weights)) != 3 | !all(names(dim(weights)) %in% c(memb_dim, time_dim, dat_dim))) + if (length(dim(weights)) != 3 | any(!names(dim(weights)) %in% c(memb_dim, time_dim, dat_dim))) stop("Parameter 'weights' must have three dimensions with the names of ", "'memb_dim', 'time_dim' and 'dat_dim'.") if (dim(weights)[memb_dim] != dim(exp)[memb_dim] | @@ -204,7 +208,7 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL "as 'memb_dim', 'time_dim' and 'dat_dim' in 'exp'.") } weights <- Reorder(weights, c(time_dim, memb_dim, dat_dim)) - + } } else if (!is.null(weights) & !is.null(cat_dim)) { .warning(paste0("Parameter 'exp' and 'obs' are probabilities already, so parameter ", @@ -222,11 +226,11 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL stop("Parameter 'ncores' must be either NULL or a positive integer.") } } - + ############################### - + # Compute RPS - + ## Decide target_dims if (!is.null(memb_dim)) { target_dims_exp <- c(time_dim, memb_dim, dat_dim) @@ -238,7 +242,7 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL } else { # cat_dim target_dims_exp <- target_dims_obs <- c(time_dim, cat_dim, dat_dim) } - + rps <- Apply(data = list(exp = exp, obs = obs), target_dims = list(exp = target_dims_exp, obs = target_dims_obs), @@ -249,10 +253,13 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL indices_for_clim = indices_for_clim, Fair = Fair, weights = weights, cross.val = cross.val, na.rm = na.rm, ncores = ncores)$output1 - - # Return only the mean RPS - rps <- MeanDims(rps, time_dim, na.rm = TRUE) - + + if (isTRUE(return_mean)) { + rps <- MeanDims(rps, time_dim, na.rm = TRUE) + } else { + rps <- rps + } + return(rps) } @@ -267,14 +274,14 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL #--- if cat_dim: # exp: [sdate, bin, (dat)] # obs: [sdate, bin, (dat)] - + # Adjust dimensions to be [sdate, memb, dat] for both exp and obs if (!is.null(memb_dim)) { if (!memb_dim %in% names(dim(obs))) { obs <- InsertDim(obs, posdim = 2, lendim = 1, name = memb_dim) } } - + if (is.null(dat_dim)) { nexp <- 1 nobs <- 1 @@ -285,17 +292,17 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL nexp <- as.numeric(dim(exp)[dat_dim]) nobs <- as.numeric(dim(obs)[dat_dim]) } - + rps <- array(dim = c(dim(exp)[time_dim], nexp = nexp, nobs = nobs)) - + for (i in 1:nexp) { for (j in 1:nobs) { exp_data <- exp[, , i] obs_data <- obs[, , j] - + if (is.null(dim(exp_data))) dim(exp_data) <- c(dim(exp)[1:2]) if (is.null(dim(obs_data))) dim(obs_data) <- c(dim(obs)[1:2]) - + # Find the fraction of NAs ## If any member/bin is NA at this time step, it is not good value. exp_mean <- rowMeans(exp_data) @@ -309,7 +316,7 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL } else { f_NAs <- na.rm } - + if (f_NAs <= sum(good_values) / length(obs_mean)) { exp_data <- exp_data[good_values, , drop = F] @@ -323,11 +330,11 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL } else { weights_data <- weights #NULL } - + # Subset indices_for_clim dum <- match(indices_for_clim, which(good_values)) good_indices_for_clim <- dum[!is.na(dum)] - + exp_probs <- .GetProbs(data = exp_data, indices_for_quantiles = good_indices_for_clim, prob_thresholds = prob_thresholds, weights = weights_data, cross.val = cross.val) @@ -347,7 +354,7 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL # rps: [sdate, nexp, nobs] rps [good_values, i, j] <- colSums((probs_exp_cumsum - probs_obs_cumsum)^2) - + if (Fair) { # FairRPS ## adjustment <- rowSums(-1 * (1/R - 1/R.new) * ens.cum * (R - ens.cum)/R/(R - 1)) ## [formula taken from SpecsVerification::EnsRps] @@ -359,17 +366,16 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL } else { ## not enough values different from NA - rps[, i, j] <- NA_real_ + rps[, i, j] <- as.numeric(NA) } - } } - + if (is.null(dat_dim)) { dim(rps) <- dim(exp)[time_dim] } - + return(rps) } -- GitLab From fede97101013d7695459d8b43acee960e980c3e8 Mon Sep 17 00:00:00 2001 From: Nadia Milders Date: Fri, 8 Mar 2024 11:57:16 +0100 Subject: [PATCH 2/4] cleaning code --- R/CRPS.R | 2 +- R/RPS.R | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/R/CRPS.R b/R/CRPS.R index c126462..5c8d836 100644 --- a/R/CRPS.R +++ b/R/CRPS.R @@ -89,7 +89,7 @@ CRPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', dat_dim = NU if (identical(as.numeric(dim(obs)[memb_dim]), 1)) { obs <- ClimProjDiags::Subset(x = obs, along = memb_dim, indices = 1, drop = 'selected') } else { - stop("Not implemented for observations with members ", + stop("Not implemented for observations with members ", "('obs' can have 'memb_dim', but it should be of length = 1).") } } diff --git a/R/RPS.R b/R/RPS.R index e7e33fa..d460742 100644 --- a/R/RPS.R +++ b/R/RPS.R @@ -154,8 +154,8 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL } if (!identical(length(name_exp), length(name_obs)) | !identical(dim(exp)[name_exp], dim(obs)[name_obs])) { - stop(paste0("Parameter 'exp' and 'obs' must have same length of ", - "all dimensions except 'memb_dim' and 'dat_dim'.")) + stop("Parameter 'exp' and 'obs' must have same length of ", + "all dimensions except 'memb_dim' and 'dat_dim'.") } ## prob_thresholds if (!is.numeric(prob_thresholds) | !is.vector(prob_thresholds) | @@ -164,7 +164,7 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL } ## indices_for_clim if (is.null(indices_for_clim)) { - indices_for_clim <- 1:dim(obs)[time_dim] + indices_for_clim <- seq_len(dim(obs)[time_dim]) } else { if (!is.numeric(indices_for_clim) | !is.vector(indices_for_clim)) { stop("Parameter 'indices_for_clim' must be NULL or a numeric vector.") @@ -187,18 +187,18 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL if (!is.array(weights) | !is.numeric(weights)) stop("Parameter 'weights' must be a named numeric array.") if (is.null(dat_dim)) { - if (length(dim(weights)) != 2 | any(!names(dim(weights)) %in% c(memb_dim, time_dim))) + if (length(dim(weights)) != 2 | !all(names(dim(weights)) %in% c(memb_dim, time_dim))) stop("Parameter 'weights' must have two dimensions with the names of ", "'memb_dim' and 'time_dim'.") if (dim(weights)[memb_dim] != dim(exp)[memb_dim] | dim(weights)[time_dim] != dim(exp)[time_dim]) { - stop(paste0("Parameter 'weights' must have the same dimension lengths ", - "as 'memb_dim' and 'time_dim' in 'exp'.")) + stop("Parameter 'weights' must have the same dimension lengths ", + "as 'memb_dim' and 'time_dim' in 'exp'.") } weights <- Reorder(weights, c(time_dim, memb_dim)) } else { - if (length(dim(weights)) != 3 | any(!names(dim(weights)) %in% c(memb_dim, time_dim, dat_dim))) + if (length(dim(weights)) != 3 | !all(names(dim(weights)) %in% c(memb_dim, time_dim, dat_dim))) stop("Parameter 'weights' must have three dimensions with the names of ", "'memb_dim', 'time_dim' and 'dat_dim'.") if (dim(weights)[memb_dim] != dim(exp)[memb_dim] | @@ -222,7 +222,7 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL ## ncores if (!is.null(ncores)) { if (!is.numeric(ncores) | ncores %% 1 != 0 | ncores <= 0 | - length(ncores) > 1) { + length(ncores) > 1) { stop("Parameter 'ncores' must be either NULL or a positive integer.") } } @@ -366,9 +366,10 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL } else { ## not enough values different from NA - rps[, i, j] <- as.numeric(NA) + rps[, i, j] <- NA_real_ } + } } -- GitLab From 7d9ee393c54a79bc9b37f040246564313f90d4bf Mon Sep 17 00:00:00 2001 From: Nadia Milders Date: Fri, 8 Mar 2024 12:07:46 +0100 Subject: [PATCH 3/4] correcting documentation --- R/CRPS.R | 3 ++- R/RPS.R | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/R/CRPS.R b/R/CRPS.R index 5c8d836..d9e2cc9 100644 --- a/R/CRPS.R +++ b/R/CRPS.R @@ -25,7 +25,7 @@ #'@param Fair A logical indicating whether to compute the FairCRPS (the #' potential CRPS that the forecast would have with an infinite ensemble size). #' The default value is FALSE. -#'@return_mean A logical idicating whether to return the temporal mean of CRPS +#'@param return_mean A logical indicating whether to return the temporal mean of CRPS #' or not. When TRUE the temporal mean is calculated, when FALSE the time #' dimension is not aggregated. The default is TRUE. #'@param ncores An integer indicating the number of cores to use for parallel @@ -138,6 +138,7 @@ CRPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', dat_dim = NU .CRPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', dat_dim = NULL, Fair = FALSE) { + # exp: [sdate, memb, (dat_dim)] # obs: [sdate, (dat_dim)] diff --git a/R/RPS.R b/R/RPS.R index d460742..1f5e6d5 100644 --- a/R/RPS.R +++ b/R/RPS.R @@ -52,7 +52,7 @@ #'@param cross.val A logical indicating whether to compute the thresholds #' between probabilistic categories in cross-validation. The default value is #' FALSE. -#'@return_mean A logical idicating whether to return the temporal mean of CRPS +#'@param return_mean A logical indicating whether to return the temporal mean of CRPS #' or not. When TRUE the temporal mean is calculated, when FALSE the time #' dimension is not aggregated. The default is TRUE. #'@param na.rm A logical or numeric value between 0 and 1. If it is numeric, it -- GitLab From 63396b825f1b742dd6f5e4abf34e500b8250a01d Mon Sep 17 00:00:00 2001 From: vagudets Date: Mon, 11 Mar 2024 09:56:32 +0100 Subject: [PATCH 4/4] Add checks, minor edits to formatting and documentation --- DESCRIPTION | 2 +- R/CRPS.R | 14 +++++++++----- R/RPS.R | 14 +++++++++----- man/CRPS.Rd | 5 +++++ man/RPS.Rd | 5 +++++ 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ec571f4..bd6fe2d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -50,5 +50,5 @@ BugReports: https://earth.bsc.es/gitlab/es/s2dv/-/issues LazyData: true SystemRequirements: cdo Encoding: UTF-8 -RoxygenNote: 7.2.0 +RoxygenNote: 7.3.1 Config/testthat/edition: 3 diff --git a/R/CRPS.R b/R/CRPS.R index d9e2cc9..bb63095 100644 --- a/R/CRPS.R +++ b/R/CRPS.R @@ -25,9 +25,9 @@ #'@param Fair A logical indicating whether to compute the FairCRPS (the #' potential CRPS that the forecast would have with an infinite ensemble size). #' The default value is FALSE. -#'@param return_mean A logical indicating whether to return the temporal mean of CRPS -#' or not. When TRUE the temporal mean is calculated, when FALSE the time -#' dimension is not aggregated. The default is TRUE. +#'@param return_mean A logical indicating whether to return the temporal mean +#' of the CRPS or not. If TRUE, the temporal mean is calculated along time_dim, +#' if FALSE the time dimension is not aggregated. The default is TRUE. #'@param ncores An integer indicating the number of cores to use for parallel #' computation. The default value is NULL. #' @@ -106,9 +106,13 @@ CRPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', dat_dim = NU "all dimensions except 'memb_dim' and 'dat_dim'.") } ## Fair - if (!is.logical(Fair) | length(Fair) > 1) { + if (!is.logical(Fair) | length(Fair) > 1) { stop("Parameter 'Fair' must be either TRUE or FALSE.") } + ## return_mean + if (!is.logical(return_mean) | length(return_mean) > 1) { + stop("Parameter 'return_mean' must be either TRUE or FALSE.") + } ## ncores if (!is.null(ncores)) { if (!is.numeric(ncores) | ncores %% 1 != 0 | ncores <= 0 | length(ncores) > 1) { @@ -127,7 +131,7 @@ CRPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', dat_dim = NU Fair = Fair, ncores = ncores)$output1 - if (isTRUE(return_mean)) { + if (return_mean) { crps <- MeanDims(crps, time_dim, na.rm = FALSE) } else { crps <- crps diff --git a/R/RPS.R b/R/RPS.R index 1f5e6d5..59b2d01 100644 --- a/R/RPS.R +++ b/R/RPS.R @@ -52,9 +52,9 @@ #'@param cross.val A logical indicating whether to compute the thresholds #' between probabilistic categories in cross-validation. The default value is #' FALSE. -#'@param return_mean A logical indicating whether to return the temporal mean of CRPS -#' or not. When TRUE the temporal mean is calculated, when FALSE the time -#' dimension is not aggregated. The default is TRUE. +#'@param return_mean A logical indicating whether to return the temporal mean +#' of the RPS or not. If TRUE, the temporal mean is calculated along time_dim, +#' if FALSE the time dimension is not aggregated. The default is TRUE. #'@param na.rm A logical or numeric value between 0 and 1. If it is numeric, it #' means the lower limit for the fraction of the non-NA values. 1 is equal to #' FALSE (no NA is acceptable), 0 is equal to TRUE (all NAs are acceptable). @@ -175,9 +175,13 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL } } ## Fair - if (!is.logical(Fair) | length(Fair) > 1) { + if (!is.logical(Fair) | length(Fair) > 1) { stop("Parameter 'Fair' must be either TRUE or FALSE.") } + ## return_mean + if (!is.logical(return_mean) | length(return_mean) > 1) { + stop("Parameter 'return_mean' must be either TRUE or FALSE.") + } ## cross.val if (!is.logical(cross.val) | length(cross.val) > 1) { stop("Parameter 'cross.val' must be either TRUE or FALSE.") @@ -254,7 +258,7 @@ RPS <- function(exp, obs, time_dim = 'sdate', memb_dim = 'member', cat_dim = NUL weights = weights, cross.val = cross.val, na.rm = na.rm, ncores = ncores)$output1 - if (isTRUE(return_mean)) { + if (return_mean) { rps <- MeanDims(rps, time_dim, na.rm = TRUE) } else { rps <- rps diff --git a/man/CRPS.Rd b/man/CRPS.Rd index 453c199..97e6a48 100644 --- a/man/CRPS.Rd +++ b/man/CRPS.Rd @@ -11,6 +11,7 @@ CRPS( memb_dim = "member", dat_dim = NULL, Fair = FALSE, + return_mean = TRUE, ncores = NULL ) } @@ -36,6 +37,10 @@ default value is NULL.} potential CRPS that the forecast would have with an infinite ensemble size). The default value is FALSE.} +\item{return_mean}{A logical indicating whether to return the temporal mean +of the CRPS or not. If TRUE, the temporal mean is calculated along time_dim, +if FALSE the time dimension is not aggregated. The default is TRUE.} + \item{ncores}{An integer indicating the number of cores to use for parallel computation. The default value is NULL.} } diff --git a/man/RPS.Rd b/man/RPS.Rd index 041ca07..b1374db 100644 --- a/man/RPS.Rd +++ b/man/RPS.Rd @@ -16,6 +16,7 @@ RPS( Fair = FALSE, weights = NULL, cross.val = FALSE, + return_mean = TRUE, na.rm = FALSE, ncores = NULL ) @@ -68,6 +69,10 @@ the weighted and unweighted methodologies is desired.} between probabilistic categories in cross-validation. The default value is FALSE.} +\item{return_mean}{A logical indicating whether to return the temporal mean +of the RPS or not. If TRUE, the temporal mean is calculated along time_dim, +if FALSE the time dimension is not aggregated. The default is TRUE.} + \item{na.rm}{A logical or numeric value between 0 and 1. If it is numeric, it means the lower limit for the fraction of the non-NA values. 1 is equal to FALSE (no NA is acceptable), 0 is equal to TRUE (all NAs are acceptable). -- GitLab