BrierScore.Rd 3.34 KB
Newer Older
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/BrierScore.R
\name{BrierScore}
\alias{BrierScore}
\title{Compute Brier score and its decomposition and Brier skill score}
\usage{
BrierScore(
  exp,
  obs,
  thresholds = seq(0, 1, 0.1),
  time_dim = "sdate",
  memb_dim = NULL,
  ncores = NULL
)
}
\arguments{
\item{exp}{A vector or a numeric array with named dimensions of the probablistic
prediction data. The dimension must at least have 'time_dim'. It may have 
'memb_dim' for performing ensemble mean. The values should be within the 
range [0, 1].}

\item{obs}{A numeric array with named dimensions of the binary observations 
(0 or 1). The dimension must at least have 'time_dim' and other dimensions 
of 'exp' except 'memb_dim'.}

\item{thresholds}{A numeric vector used to bin the forecasts. The default 
value is \code{seq(0, 1, 0,1)}, which means that the bins are 
 \code{[0,0.1), [0.1, 0.2), ... [0.9, 1]}.}

\item{time_dim}{A character string indicating the name of dimension along
which Brier score is computed. The default value is 'sdate'.}

\item{memb_dim}{A character string of the name of the member dimension. It 
must be one dimension of 'exp'. The function will do the ensemble mean 
over this dimension. If there is no member dimension, set NULL. The default
value is NULL.}
}
\value{
A list that contains:
The numeric arrays with all 'exp' and 'obs' dimensions expect 'time_dim' and
'memb_dim': 
\item{$rel}{standard reliability}
\item{$res}{standard resolution}
\item{$unc}{standard uncertainty}  
\item{$bs}{Brier score}
\item{$bs_check_res}{rel - res + unc}
\item{$bss_res}{res - rel / unc}
\item{$gres}{generalized resolution}
\item{$bs_check_gres}{rel - gres + unc}
\item{$bss_gres}{gres - rel / unc}
\item{$rel_bias_corrected}{bias - corrected rel}
\item{$gres_bias_corrected}{bias - corrected gres}
\item{$unc_bias_corrected}{bias - corrected unc}
\item{$bss_bias_corrected}{gres_bias_corrected - rel_bias_corrected / unc_bias_corrected}
The numeric arrays with the same dimensions as above and one additional
dimension 'bin':
\item{$nk}{number of forecast in each bin}
\item{$fkbar}{average probability of each bin}
\item{$okbar}{relative frequency that the observed event occurred}
}
\description{
Compute the Brier score (BS) and the components of its standard decompostion
as well with the two within-bin components described in Stephenson et al., 
(2008). It also returns the bias-corrected decomposition of the BS (Ferro and
Fricker, 2012). BSS has the climatology as the reference forecast.
}
\examples{
# Inputs are vectors
exp <- runif(10)
obs <- round(a)
x <- BrierScore(exp, obs)
res <- x$bs - x$bs_check_res
res <- x$bs - x$bs_check_gres
res <- x$rel_bias_corrected - x$gres_bias_corrected + x$unc_bias_corrected

# Inputs are arrays
example(Load)
bins_ano_exp <- ProbBins(ano_exp, thr = c(1/3, 2/3), posdates = 3, posdim = 2)
bins_ano_obs <- ProbBins(ano_obs, thr = c(1/3, 2/3), posdates = 3, posdim = 2)
res <- BrierScore(bins_ano_exp, MeanDims(bins_ano_obs, 'member'), memb_dim = 'member') 

}
\references{
Wilks (2006) Statistical Methods in the Atmospheric Sciences.\cr
Stephenson et al. (2008). Two extra components in the Brier score decomposition. 
 Weather and Forecasting, 23: 752-757.\cr
Ferro and Fricker (2012). A bias-corrected decomposition of the BS. 
 Quarterly Journal of the Royal Meteorological Society, DOI: 10.1002/qj.1924.
}