CPA {SeaVal} | R Documentation |
Coefficients of Predictive Ability
Description
Function for calculating coefficients of predictive ability (CPAs) of ensemble mean forecasts stored in long data tables:#' Can also handle point forecasts. Warning: This metric always needs several years of data since the ranks on which it is based are calculated across multi-year samples.
Usage
CPA(
dt,
f,
o = "obs",
by = by_cols_ens_fc_score(dt),
pool = "year",
mem = "member",
dim.check = TRUE
)
Arguments
dt |
Data table containing the predictions. |
f |
column name of the prediction. |
o |
column name of the observations. |
by |
column names of grouping variables, all of which need to be columns in dt. A separate CPA is computed for each value of the grouping variables. Default is to group by all instances of month, season, lon, lat, system and lead_time that are columns in dt. |
pool |
column name(s) for the variable(s) along which is averaged. Needs to contain 'year' per warning above. |
mem |
Number of column containing the number of the ensemble member. |
dim.check |
Logical. If True, a simple test whether the dimensions match up is conducted: The data table should only have one row for each level of c(by,pool,mem) |
Value
A data table with the scores
Examples
dt = data.table(fc = 1:4,obs = c(4,4,7,7),member = c(1,2,1,2),year = c(1999,1999,2000,2000))
CPA(dt,f = 'fc')