Calculates the multilinear regression between several images contained in InMatrices and the image specified by TargetMatrix. The input images are stored layerwise in the three dimensional matrix InMatrices. The function returns a zero value if the result is valid. In this case the coefficients a_{0} to a_{n} of the solution are contained in the open array coeffs.
The open array deltacoeffs reflects the uncertainties of the estimated parameters returned in coeffs. In order to get the standard deviation of the parameters, deltacoeffs has to be multiplied by the standard error of the residuals. The standard error can be calculated by
with n = number of pixels uses for the model, k = number of layers of InMatrices, Y_{i} = target data, and Y_{i}hat being the estimated target data.
The equation system to be solved can be denoted as follows (the coefficients a_{i} correspond to the parameter coeffs, the values y_{mn} are stored in TargetMatrix, and the values x_{mnp} are taken from the layers of the matrix InMatrices). The indices m and n refer to the x and ycoordinates of the images, the index p denotes the layer index (please note that the indices of the actual matrices are 0based, while the indices in the equation system start with 1):
The function returns the following error codes:
0 ... everything is OK
1 ... regression was impossible to compute, results are invalid
2 ... the data is near singular, do not use the results (numerical instabilities)
3 ... the matrix InMatrices and the matrix TargetMatrix do not match in size
