Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • s2dv s2dv
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 17
    • Issues 17
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Earth SciencesEarth Sciences
  • s2dvs2dv
  • Issues
  • #128
Closed
Open
Issue created May 09, 2025 by Carlos Delgado Torres@cdelgadoMaintainer

Wrong RPSS when inputs are probabilities

Hi @abatalla and @vagudets,

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

Assignee
Assign to
Time tracking