Wrong RPSS when inputs are probabilities
Summary
The RPSS function fails when prob_thresholds = NULL
or prob_thresholds = NA
, even if the inputs are probabilities (and memb_dim = NULL
, cat_dim = 'bin'
) -- please see rpss1
in the code below. Then, I had to put some random prob_thresholds
, even if they must not be used because the probabilities are already computed beforehand. I tried setting two different prob_thresholds
to check that the results are identical, but they are not -- please see rpss2
and rpss3
in the code below.
Could you please have a look at it?
Example
library(s2dv)
set.seed(1)
exp <- array(rnorm(3000), dim = c(member = 10, sdate = 30))
obs <- array(rnorm(3000), dim = c(sdate = 30))
exp_probs <- GetProbs(exp, memb_dim = 'member')
obs_probs <- GetProbs(obs, memb_dim = NULL)
rpss1 <- s2dv::RPSS(exp = exp_probs, obs = obs_probs, ref = NULL, time_dim = 'sdate', memb_dim = NULL, cat_dim = 'bin', dat_dim = NULL,
prob_thresholds = NULL, indices_for_clim = NULL, Fair = FALSE, weights_exp = NULL, weights_ref = NULL,
cross.val = FALSE, na.rm = FALSE, sig_method.type = 'two.sided.approx', alpha = 0.05, N.eff = FALSE, ncores = 1)
# Error in s2dv::RPSS(exp = exp_probs, obs = obs_probs, ref = NULL, time_dim = "sdate", :
# Parameter 'prob_thresholds' must be a numeric vector between 0 and 1.
rpss2 <- s2dv::RPSS(exp = exp_probs, obs = obs_probs, ref = NULL, time_dim = 'sdate', memb_dim = NULL, cat_dim = 'bin', dat_dim = NULL,
prob_thresholds = c(1/3,2/3), indices_for_clim = NULL, Fair = FALSE, weights_exp = NULL, weights_ref = NULL, cross.val = FALSE, na.rm = FALSE,
sig_method.type = 'two.sided.approx', alpha = 0.05, N.eff = FALSE, ncores = 1)
rpss3 <- s2dv::RPSS(exp = exp_probs, obs = obs_probs, ref = NULL, time_dim = 'sdate', memb_dim = NULL, cat_dim = 'bin', dat_dim = NULL,
prob_thresholds = c(1/3,2.5/3), indices_for_clim = NULL, Fair = FALSE, weights_exp = NULL, weights_ref = NULL, cross.val = FALSE, na.rm = FALSE,
sig_method.type = 'two.sided.approx', alpha = 0.05, N.eff = FALSE, ncores = 1)
print(rpss2)
# $rpss
# [1] -0.1685
#
# $sign
# [1] FALSE
print(rpss3)
# $rpss
# [1] -0.09976471
#
# $sign
# [1] FALSE
Module and Package Version
Machine: hub R version: R version 4.4.1 R package: s2dv_2.1.0
Please let me know if something is unclear, or if you want to discuss it in a meeting.
Thanks a lot in advance,
Carlos @nperez @vtorralba