% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Trend.R
\name{Trend}
\alias{Trend}
\title{Compute the Trend of the Ensemble Mean}
\usage{
Trend(data, time_dim = "sdate", interval = 1, siglev = 0.95,
  conf = TRUE, polydeg = 1, ncores = NULL)
}
\arguments{
\item{data}{An numeric array including the dimension along which the trend 
is computed.}

\item{time_dim}{A character string indicating the dimension along which to 
compute the trend.}

\item{interval}{A positive numeric indicating the unit length between two 
points along 'time_dim' dimension. Set 1 as default.}

\item{siglev}{A numeric indicating the confidence level for the 
regression computation. Set 0.95 as default.}

\item{conf}{A logical value indicating whether to retrieve the confidence 
intervals or not. Set TRUE as default.}

\item{polydeg}{A positive integer indicating the degree of polynomial 
regression. Set 1 as default.}

\item{ncores}{An integer indicating the number of cores to use for parallel 
computation. Default value is NULL.}
}
\value{
\item{$trend}{
 A numeric array with same dimensions as parameter 'data' except the 
 'time_dim' dimension, which is replaced by a 'stats' dimension containing 
 the regression coefficients from the lowest order (i.e., intercept) to 
 the highest degree. The length of the 'stats' dimension should be 
 \code{polydeg + 1}.  
}
\item{$conf.lower}{
 A numeric array with same dimensions as parameter 'data' except the 
 'time_dim' dimension, which is replaced by a 'stats' dimension containing 
 the lower limit of the \code{siglev}\% confidence interval for all
 the regression coefficients with the same order as $trend. The length of the 
 'stats' dimension should be \code{polydeg + 1}. Only present if \code{conf = TRUE}.
}
\item{$conf.upper}{
 A numeric array with same dimensions as parameter 'data' except the 
 'time_dim' dimension, which is replaced by a 'stats' dimension containing 
 the upper limit of the \code{siglev}\% confidence interval for all
 the regression coefficients with the same order as $trend. The length of the 
 'stats' dimension should be \code{polydeg + 1}. Only present if \code{conf = TRUE}.
}
\item{$detrended}{
 A numeric array with the same dimensions as paramter 'data', the detrended 
 values along the 'time_dim' dimension.
}
}
\description{
Compute the polynomial regression along the forecast time with any degree of 
polynomial. It returns the regression coefficients (including the intercept) 
and the confidence intervals if needed. The detrended array is also provided.\cr
The confidence interval relies on the student-T distribution.\cr\cr
}
\examples{
# Load sample data as in Load() example:
example(Load)
months_between_startdates <- 60
trend <- Trend(sampleData$obs, polydeg = 2)

}
\author{
History:\cr
0.1  -  2011-05  (V. Guemas, \email{virginie.guemas@ic3.cat})  -  Original code\cr
1.0  -  2013-09  (N. Manubens, \email{nicolau.manubens@ic3.cat})  -  Formatting to CRAN\cr
2.0  -  2017-02  (A. Hunter, \email{alasdair.hunter@bsc.es})  -  Adapt to veriApply()
3.0  -  2019-12  (A. Ho, \email{an.ho@bsc.es})  -  Adapt to multiApply()
}
\keyword{datagen}

