Skip to contents

Helper function to identify duplicate forecasts, i.e. instances where there is more than one forecast for the same prediction target.

Usage

find_duplicates(data, forecast_unit)

Arguments

data

A data.frame as used for score()

forecast_unit

A character vector with the column names that define the unit of a single forecast. If missing the function tries to infer the unit of a single forecast.

Value

A data.frame with all rows for which a duplicate forecast was found

Examples

example <- rbind(example_quantile, example_quantile[1000:1010])
find_duplicates(example)
#>     location target_end_date target_type true_value location_name forecast_date
#>  1:       DE      2021-05-22      Deaths       1285       Germany    2021-05-17
#>  2:       DE      2021-05-22      Deaths       1285       Germany    2021-05-17
#>  3:       DE      2021-05-22      Deaths       1285       Germany    2021-05-17
#>  4:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#>  5:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#>  6:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#>  7:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#>  8:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#>  9:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#> 10:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#> 11:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#> 12:       DE      2021-05-22      Deaths       1285       Germany    2021-05-17
#> 13:       DE      2021-05-22      Deaths       1285       Germany    2021-05-17
#> 14:       DE      2021-05-22      Deaths       1285       Germany    2021-05-17
#> 15:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#> 16:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#> 17:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#> 18:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#> 19:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#> 20:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#> 21:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#> 22:       DE      2021-05-29       Cases      31653       Germany    2021-05-10
#>     location target_end_date target_type true_value location_name forecast_date
#>     quantile prediction                 model horizon
#>  1:    0.950       1464  epiforecasts-EpiNow2       1
#>  2:    0.975       1642  epiforecasts-EpiNow2       1
#>  3:    0.990       1951  epiforecasts-EpiNow2       1
#>  4:    0.010      28999 EuroCOVIDhub-ensemble       3
#>  5:    0.025      32612 EuroCOVIDhub-ensemble       3
#>  6:    0.050      36068 EuroCOVIDhub-ensemble       3
#>  7:    0.100      41484 EuroCOVIDhub-ensemble       3
#>  8:    0.150      47110 EuroCOVIDhub-ensemble       3
#>  9:    0.200      50929 EuroCOVIDhub-ensemble       3
#> 10:    0.250      54561 EuroCOVIDhub-ensemble       3
#> 11:    0.300      57739 EuroCOVIDhub-ensemble       3
#> 12:    0.950       1464  epiforecasts-EpiNow2       1
#> 13:    0.975       1642  epiforecasts-EpiNow2       1
#> 14:    0.990       1951  epiforecasts-EpiNow2       1
#> 15:    0.010      28999 EuroCOVIDhub-ensemble       3
#> 16:    0.025      32612 EuroCOVIDhub-ensemble       3
#> 17:    0.050      36068 EuroCOVIDhub-ensemble       3
#> 18:    0.100      41484 EuroCOVIDhub-ensemble       3
#> 19:    0.150      47110 EuroCOVIDhub-ensemble       3
#> 20:    0.200      50929 EuroCOVIDhub-ensemble       3
#> 21:    0.250      54561 EuroCOVIDhub-ensemble       3
#> 22:    0.300      57739 EuroCOVIDhub-ensemble       3
#>     quantile prediction                 model horizon