\name{ProbBins}
\alias{ProbBins}
\title{
  Computes probabilistic information of a forecast relative to a
  threshold or a quantile. 
}
\description{
  Compute probabilistic bins of a forecast year (fcyr) relative to
  the forecast climatology over the whole period of anomalies
  excluding the selected forecast year (fcyr).
}
\usage{
  ProbBins(ano, fcyr, thr, quantile=TRUE, posdates=3, posdim=2, 
           compPeriod = "Full period")
}
\arguments{
  \item{ano}{
    Array of anomalies from Ano.
    Must be of dimension (nexp, nmemb, nsdates, nleadtime, nlon,  nlat)
  }
  \item{fcyr}{
    Number of the forecast year of the anomalies.
  }
  \item{thr}{
    values used to bin the anomalies.
  }
  \item{quantile}{
    If quantile=TRUE (default), the threshold (thr) are
    quantiles.
    If quantile=FALSE the threshold (thr) 
    introduced are the specified thresholds.
  }
  \item{posdates}{
    Position of the associated dimension with the start dates
    (default=3).
  }
  \item{posdim}{
    Position of the dimension which will be combined with posdates
    to compute the quantiles (default=2).
  }
  \item{compPeriod}{
    Three options: "Full period"/"Without fcyr"/"cross-validation"(The
    probabilities are computed with the terciles based on ano/ano
    with the removed fcyr/cross-validation)(default=Full period).
  }
}
\value{
  Matrix with probabilistic information and dimensions:
  c(length(thr+1), nfcyr ,nmemb/nparam, nmod/nexp/nobs, nfcyr,
  nltime, nlat, nlon)
}
\examples{
sampleMap <- Load('tos', c('i00k'), c('ERSST'), c('19851101',
'19901101', '19951101', '20001101', '20051101'), nleadtime = 124,
leadtimemin = 1, leadtimemax = 60, sampleperiod = 1, output = 'lonlat',
latmin = 30, latmax = 45, lonmin = 0, lonmax = 40)

clim <- Clim(sampleMap$mod, sampleMap$obs)
ano_exp <- Ano(sampleMap$mod, clim$clim_exp)
PB<-ProbBins(ano_exp, fcyr=3, thr=c(1/3,2/3), quantile=TRUE, posdates=3,
posdim=2)
 
}
\author{
  History:
  1.0  -  2013  (F.Lienert)  -  Original code
  2.0  -  2014-03  (N. Gonzalez and V.Torralba, \email{veronica.torralba@ic3.cat})  -  debugging
}
\keyword{datagen}
