fdbk_dt_crps_norm: Calculate CRPS and Ignorance score from data.table with EPS...

Description Usage Arguments Value Author(s) Examples

View source: R/fdbk_asdataframe.R

Description

Calculate CRPS and Ignorance score from data.table with EPS mean/spread, assuming a normally distributed EPS In case of zero standard deviation CRPS and Ignorance would return NA, those cases are omitted in this function so that a score should always be returned, except all ensemble predictions have zero standard deviation.

Usage

1

Arguments

DT

data.table (columns 'veri_description','obs' and 'veri_data' are required!!!) values of veri_description have to be "mean" or "spread"

by

stratify crps by (e.g. 'varno')

Value

data.table with columns as defined in 'by' plus scorename plus score

Author(s)

Felix <[email protected]>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
require(ggplot2)
fnames      = system("/bin/ls ~/examplesRfdbk/eps/*12/verTEMP*",intern=T)
condition   = list(
                           veri_description="grepl('first guess',veri_description)",
                           veri_description="grepl('ensemble',veri_description)",
                           state="state%in%c(0,1)",
                           level="level%in%c(100000,92500,85000,75000,70000,50000,40000,30000,25000,20000,10000)",
                           veri_forecast_time="veri_forecast_time>=1200",
                           varno="varno!=1")
vars        = c("obs","veri_data","varno","level","veri_description","veri_forecast_time")
DT          = fdbk_dt_multi_large(fnames,condition,vars,5)
DT[grepl("mean",veri_description),veri_description:="mean"]
DT[grepl("spread",veri_description),veri_description:="spread"]
by=c("varno","level","veri_forecast_time")
CRPS = fdbk_dt_crps_norm(DT,by)
CRPS[,varno:=varno_to_name(varno,F)]
CRPS[scorename=="IGN" & score>10000,score:=NA]
ggplot(CRPS,aes(x=score,y=level,color=factor(veri_forecast_time),group=veri_forecast_time))+
  geom_path()+geom_point()+facet_wrap(~scorename~varno,scale="free_x",ncol=4)+
  scale_y_reverse()+theme_bw()+scale_colour_discrete("lead-time")

rfxf/Rfdbk documentation built on Dec. 17, 2018, 9:14 a.m.