\name{Regression}
\alias{Regression}
\title{
  Compute The Regression Of A Matrix On Another Along A Dimension
}
\description{
  Compute the regression of matrice vary on matrice varx along the (posREG)th 
  dimension by least square fitting. Provides the slope of the regression, the 
  associated confidence interval, and the intercept.
  Provide also the vary data filtered out from the regression onto varx.
  The confidence interval relies on a student-T distribution.
}
\usage{
  Regression(vary, varx, posREG = 2)
}
\arguments{
  \item{vary}{
    Matrix of any number of dimensions up to 10.
  }
  \item{varx}{
    Matrix of any number of dimensions up to 10.
  }
  \item{posREG}{
    Position along which to compute the regression.
  }
}
\value{
  \item{$regression}{
    Matrix 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 computed slope and the upper limit of 
    the 95% confidence interval and the intercept for each point of the matrice 
    along all the other dimensions.
  }
  \item{$filtered}{
     Same dimensions as vary filtered out from the regression onto varx along 
     the posREG dimension.
  }
}
\author{
  History:
  1.0  -  2013-05  (V. Guemas, \email{vguemas@ic3.cat})  -  Original code
}
\keyword{datagen}
