% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/GetProbs.R
\name{GetProbs}
\alias{GetProbs}
\title{Compute probabilistic forecasts or the corresponding observations}
\usage{
GetProbs(
  data,
  time_dim = "sdate",
  memb_dim = "member",
  indices_for_quantiles = NULL,
  prob_thresholds = c(1/3, 2/3),
  weights = NULL,
  cross.val = FALSE,
  ncores = NULL
)
}
\arguments{
\item{data}{A named numerical array of the forecasts or observations with, at 
least, time dimension.}

\item{time_dim}{A character string indicating the name of the time dimension.
The default value is 'sdate'.}

\item{memb_dim}{A character string indicating the name of the member dimension
to compute the probabilities of the forecast, or NULL if there is no member
dimension (e.g., for observations, or for forecast with only one ensemble
member). The default value is 'member'.}

\item{indices_for_quantiles}{A vector of the indices to be taken along 'time_dim' 
for computing the absolute thresholds between the probabilistic categories. 
If NULL, the whole period is used. The default value is NULL.}

\item{prob_thresholds}{A numeric vector of the relative thresholds (from 0 to
1) between the categories. The default value is c(1/3, 2/3), which 
corresponds to tercile equiprobable categories.}

\item{weights}{A named numerical array of the weights for 'data' with 
dimensions 'time_dim' and 'memb_dim' (if 'data' has them). The default value is 
NULL. The ensemble should have at least 70 members or span at least 10 time 
steps and have more than 45 members if consistency between the weighted and
unweighted methodologies is desired.}

\item{cross.val}{A logical indicating whether to compute the thresholds between 
probabilistic categories in cross-validation mode. The default value is FALSE.}

\item{ncores}{An integer indicating the number of cores to use for parallel 
computation. The default value is NULL.}

\item{dat_dim}{A character string indicating the name of dataset dimension. 
The default value is NULL, which means no dataset dimension.}
}
\value{
A numerical array of probabilities with dimensions c(bin, the rest dimensions
of 'data' except 'memb_dim'). 'bin' dimension has the length of probabilistic 
categories, i.e., \code{length(prob_thresholds) + 1}.
}
\description{
Compute probabilistic forecasts from an ensemble based on the relative thresholds, 
or the probabilistic observations (i.e., which probabilistic category was observed). 
A reference period can be specified to calculate the absolute thresholds between 
each probabilistic category. The absolute thresholds can be computed in cross-validation 
mode. If data is an ensemble, the probabilities are calculated as the percentage of 
members that fall into each category. For observations (or forecast without member 
dimension), 1 means that the event happened, while 0 indicates that the event did 
not happen. Weighted probabilities can be computed if the weights are provided for 
each ensemble member and time step.
}
\examples{
data <- array(rnorm(2000), dim = c(ensemble = 25, sdate = 20, time = 4))
res <- GetProbs(data = data, time_dim = 'sdate', memb_dim = 'ensemble', indices_for_quantiles = 4:17)

}
