% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Regression.R
\name{Regression}
\alias{Regression}
\title{Computes The Regression Of An Array On Another Along A Dimension}
\usage{
Regression(vary, varx, posREG = "member", na.action = na.omit, formula = y
  ~ x)
}
\arguments{
\item{vary}{Array of any number of named dimensions.}

\item{varx}{Array of any number of named dimensions. 
The same dimensions as vary are expected.}

\item{posREG}{The name of the dimension along which to compute the regression.}

\item{na.action}{a logical value indicating whether NA values should be stripped before the computation proceeds or a numeric value indicating the maximum number of NA values allowed to compute the regression.}

\item{formula}{an object of class "formula" (see function \code{link[stats]{lm}}).}
}
\value{
\item{$regression}{
   Array with same dimensions as varx and vary except along posREG 
   dimension which is replaced by a length 4 dimension, corresponding 
   to the lower limit of the 95\% confidence interval, the slope, 
   the upper limit of the 95\% confidence interval and the intercept.
 }
 \item{$filtered}{
   Same dimensions as vary filtered out from the regression onto varx 
   along the posREG dimension.
 }
}
\description{
Computes the regression of the input matrice vary on the input matrice varx 
along the posREG dimension by least square fitting. Provides the slope of 
the regression, the associated confidence interval, and the intercept.\cr
Provides also the vary data filtered out from the regression onto varx.\cr
The confidence interval relies on a student-T distribution.
}
\examples{
vary <- 1:(2*3*4*5*6)
dim(vary) <- c(lat = 2, lon = 3, member = 4, time = 6, sdate = 5)
varx <- vary
res <- Regression(vary, varx, posREG = 'time')
str(res)
vary[1] <- NA
res <- Regression(vary, varx, posREG = 'time')
}
\author{
History:\cr
0.1  -  2013-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
2.0  -  2019-10  (N. Perez-Zanon, \email{nuria.perez@bsc.es})  -  Formatting to multiApply
}
\keyword{datagen}

