FK83 / scoringRules

scoring rules to evaluate probabilistic forecasts
53 stars 16 forks source link

Bug specifying bw in logs_sample #56

Closed ghurault closed 10 months ago

ghurault commented 10 months ago

Hi, Thanks for the package. I think I have found a bug when specifying bw when calling logs_sample. If y is a vector, dat is a matrix, bw should be a vector of the same length as y according to the documentation. In that case, my understanding is that the function calls check_sample2 from scores_sample_univ.R which throws an error in

if (!is.null(input$bw)) {
    if (input$bw < 0) {
      stop("Bandwidth parameter 'bw' is negative.")
    }
}

More specifically in if (input$bw < 0) ... as "the condition has length > 1". I think input$bw < 0 should be replaced by any(input$bw < 0) if I am understanding the code correctly. Thanks

aijordan commented 10 months ago

Hi @ghurault, thanks for the thorough check. You are absolutely right, of course.

PR incoming.