Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`crps.numeric` does not pass `permutations` correctly to `crps.matrix`

Open Beginner friendly
#397 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
r
Domain
backend, tooling

Research direction

The issue is in R/crps.R line 97 where permutations is not passed correctly. Start by examining the crps.numeric function and its call to crps.matrix. Ensure the permutations argument is explicitly passed. Also check scrps.numeric for the same pattern. Run the provided reproducible example to verify the fix.

Written by the indexing model from the issue text.

Description

Minimal reproducible example:

paste("loo version:", packageVersion("loo"), "\n") |> cat()

N = 1000000

cat("crps.numeric:\n")
system.time(
  loo:::crps.numeric(1:3, 4:6, 5, permutations=N)
)

cat("crps.matrix:\n")
system.time(
  loo:::crps.matrix(as.matrix(1:3), as.matrix(4:6), 5, permutations=N)
)

Output on my machine:

loo version: 2.10.1
crps.numeric:
   user  system elapsed
  0.007   0.002   0.009
crps.matrix:
   user  system elapsed
  6.954   0.033   6.989

I believe the issue is with this line:

https://github.com/stan-dev/loo/blob/df27ade95093db66cebf19d55530439386ac1a97/R/crps.R#L97

The permutations argument gets absorbed into the ...; I believe it needs to be passed as a named argument.

Also applies to scrps.numeric.

Dominant language
R
Stars
157
Forks
38
Avg merge
4d 16h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stan-dev/loo

All issues in stan-dev/loo

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.