Contains method common for all multivariate regressions.
Explanation of variables common to all methods:
NumberOfPoints: Number of measurements for calibration. Each measurement is represented by a spectrum X (or set of independent variables) and a set of corresponding concentrations Y (or dependent variables)
NumberOfX: Number of spectral values (or number of independent variables).
NumberOfY: Number of concentrations (or number of dependent variables).
NumberOfFactors: Number of main components used for prediction or calculation.
X: Matrix of spectra( or independent variables). The spectra are horizontal oriented, i.e. one spectra is a row in the X matrix.
Y: Matrix of concentration (or dependent variables). One set of concentrations is also represented by one row in the matrix.
XU: Matrix of unknown spectra (or independent variables) used for prediction of the Y variables.
SpectralRegions: If the spectra consists of more than one regions, these regions should be preprocessed separately. To designate them, one has to provide an array of ascending integer values. Each element of this region designates the starting index of a spectral region.
Constructor | Description |
Full Usage:
MultivariateRegression()
|
|
Instance member | Description |
Full Usage:
this.AnalyzeFromPreprocessed
Parameters:
IROMatrix<float>
-
The spectral matrix (each spectrum is a row in the matrix). They must at least be centered.
matrixY : IROMatrix<float>
-
The matrix of concentrations (each experiment is a row in the matrix). They must at least be centered.
maxFactors : int
-
Maximum number of factors for analysis.
|
Creates an analyis from preprocessed spectra and preprocessed concentrations.
|
Full Usage:
this.AnalyzeFromRaw
Parameters:
SpectralPreprocessingOptions
-
Information how to preprocess the data.
spectralRegions : int[]
-
Array of ascending indices representing the starting indices of spectral regions.
matrixX : IMatrix<float>
-
Matrix of preprocessed spectra (number of observations, number of wavelengths).
matrixY : IMatrix<float>
-
Matrix of preprocessed y values (number of observations, number of y).
maxFactors : int
-
Maximum number of factors to calculate.
|
Creates an analyis from the raw spectra and raw concentrations.
|
Full Usage:
this.AnalyzeFromRaw
Parameters:
SpectralPreprocessingOptions
-
Information how to preprocess the data.
xOfX : IReadOnlyList<float>
-
The spectral x variable (e.g. frequencies, wavelength).
matrixX : IMatrix<float>
-
Matrix of preprocessed spectra (number of observations, number of wavelengths).
matrixY : IMatrix<float>
-
Matrix of preprocessed y values (number of observations, number of y).
maxFactors : int
-
Maximum number of factors to calculate.
|
Creates an analyis from the raw spectra and raw concentrations.
|
|
Returns the calibration model of the analysis.
|
|
Returns the predicted error sum of squares (PRESS) for this analysis. The length of the vector returned is the number of factors in the analysis plus one.
|
Full Usage:
this.GetPredictionScores
Parameters:
int
-
Number of factors used for calculation.
Returns: IROMatrix<float>
The prediction score matrix. This matrix has the dimensions (NumberOfX, NumberOfY).
Modifiers: abstract |
Calculates the prediction scores.
|
Full Usage:
this.GetXLeverageFromPreprocessed
Parameters:
IROMatrix<float>
-
Matrix of spectra (a spectrum = a row in the matrix).
numFactors : int
-
Number of factors used for calculation.
Returns: IROMatrix<float>
Matrix of spectral leverages. Normally, this is a (NumberOfPoints,1) matrix, with exception of PLS1, where it is a (NumberOfPoints,NumberOfY) matrix.
Modifiers: abstract |
Calculates the spectral leverage from preprocessed spectra.
|
Full Usage:
this.GetXLeverageFromRaw
Parameters:
SpectralPreprocessingOptions
-
matrixX : IMatrix<float>
-
Matrix of spectra (a spectrum = a row in the matrix).
numFactors : int
-
Number of factors used for calculation.
Returns: IROMatrix<float>
Matrix of spectral leverages. Normally, this is a (NumberOfPoints,1) matrix, with exception of PLS1, where it is a (NumberOfPoints,NumberOfY) matrix.
Modifiers: abstract |
Calculates the spectral leverage from raw spectra.
|
Full Usage:
this.GetXLeverageFromRaw
Parameters:
IMatrix<float>
-
Matrix of spectra (a spectrum = a row in the matrix).
numFactors : int
-
Number of factors used for calculation.
Returns: IROMatrix<float>
Matrix of spectral leverages. Normally, this is a (NumberOfPoints,1) matrix, with exception of PLS1, where it is a (NumberOfPoints,NumberOfY) matrix.
Modifiers: abstract |
Calculates the spectral leverage from raw spectra.
|
|
Returns the calibration model of the analysis.
|
Full Usage:
this.NumberOfFactors
Returns: int
|
Returns the number of factors calculated during the analysis.
|
Full Usage:
this.NumberOfSpectralResiduals
Returns: int
Modifiers: abstract |
This returns the number of spectral residuals. This is normally 1, but for the PLS1 analyis, it is the NumberOfY.
|
Full Usage:
this.PredictYFromPreprocessed
Parameters:
IROMatrix<float>
-
Matrix of unknown spectra (preprocessed the same way as the calibration spectra).
numFactors : int
-
Number of factors used for prediction.
predictedY : IMatrix<float>
-
On return, holds the predicted y values. (They are centered).
Modifiers: abstract |
This predicts concentrations of unknown spectra. |
Full Usage:
this.PredictYFromPreprocessed
Parameters:
IROMatrix<float>
-
Matrix of unknown spectra (preprocessed the same way as the calibration spectra).
numFactors : int
-
Number of factors used for prediction.
Returns: IROMatrix<float>
The predicted y values. (They are centered).
Modifiers: abstract |
This predicts concentrations of unknown spectra.
|
Full Usage:
this.PredictYFromRaw
Parameters:
IMatrix<float>
-
Matrix of spectra used for prediction (number of spectra, number of wavelengths).
numFactors : int
-
Number of factors used for prediction.
predictedY : IMatrix<float>
-
In return, holds the predicted y values. You have to provide a matrix of
dimensions (number of spectra, number of y).
|
Predicts y values from raw (unpreprocessed) spectra.
|
Full Usage:
this.PredictedYAndSpectralResidualsFromPreprocessed
Parameters:
IROMatrix<float>
-
Spectra (horizontally oriented).
numFactors : int
-
Number of factors used for calculation.
predictedY : IMatrix<float>
-
On return, holds the predicted y values. (They are centered).
spectralResiduals : IMatrix<float>
-
On return, holds the spectral residual values.
Modifiers: abstract |
This calculates the spectral residuals. |
Full Usage:
this.PredictedYAndSpectralResidualsFromPreprocessed
Parameters:
IROMatrix<float>
-
Spectra (horizontally oriented).
numFactors : int
-
Number of factors used for calculation.
predictedY : byref<IMatrix<float>>
-
On return, holds the predicted y values. (They are centered). If the matrix you provide has not the appropriate dimensions, it is reallocated.
spectralResiduals : byref<IMatrix<float>>
-
On return, holds the spectral residual values. If the matrix you provide has not the appropriate dimensions, it is reallocated.
Modifiers: abstract |
This calculates the spectral residuals. The matrices are reallocated if they don't have the appropriate dimensions.
|
Full Usage:
this.PredictedYAndSpectralResidualsFromPreprocessed
Parameters:
IROMatrix<float>
-
Spectra (horizontally oriented).
numFactors : int
-
Number of factors used for calculation.
calculatePredictedY : bool
-
If true, the predictedY is calculated. Otherwise, predictedY is null on return.
predictedY : byref<IMatrix<float>>
-
On return, holds the predicted y values. (They are centered). If the matrix you provide has not the appropriate dimensions, it is reallocated.
calculateSpectralResiduals : bool
-
If true, the spectral residuals are calculated. Otherwise spectralResiduals is null on return.
spectralResiduals : byref<IMatrix<float>>
-
On return, holds the spectral residual values. If the matrix you provide has not the appropriate dimensions, it is reallocated.
Modifiers: abstract |
This calculates the spectral residuals. The matrices are reallocated if they don't have the appropriate dimensions.
|
Full Usage:
this.Reset
Modifiers: abstract |
Resets the regression, so that it appears like newly created. |
Full Usage:
this.SetCalibrationModel
Parameters:
IMultivariateCalibrationModel
-
The calibration set for use in the analysis. The provided calibration model have to correspond to
the type of analysis.
Modifiers: abstract |
This sets the calibration model data of the analysis to the provided data. This can be used to set back previously stored calibration data for use in the prediction functions.
|
|
This calculates the spectral residuals. |
|
This calculates the spectral residuals.
|
Static member | Description |
Full Usage:
MultivariateRegression.CrossValidationIteration(X, Y, groupingStrategy, crossFunction)
Parameters:
IROMatrix<float>
-
Matrix of spectra (horizontal oriented).
Y : IROMatrix<float>
-
Matrix of y values.
groupingStrategy : ICrossValidationGroupingStrategy
-
The strategy how to separate the spectra into the calibration and prediction spectra.
crossFunction : CrossValidationIterationFunction
-
The function that is called for each separation.
Returns: float
The mean number of spectra that was used for prediction.
|
This function separates the spectra into a bunch of spectra used for calibration and the rest of spectra used for prediction. This separation is repeated until all spectra are used exactly one time for prediction.
|
Full Usage:
MultivariateRegression.GetCrossPRESS(spectralRegions, X, Y, numFactors, groupingStrategy, preprocessOptions, regress, crossPRESS)
Parameters:
int[]
-
Array of ascending indices representing the starting indices of spectral regions.
X : IROMatrix<float>
-
Matrix of spectra (a spectrum = a row in the matrix).
Y : IROMatrix<float>
-
Matrix of y values (e.g. concentrations).
numFactors : int
-
Maximum number of factors to calculate the cross PRESS for.
groupingStrategy : ICrossValidationGroupingStrategy
-
The strategy how to group the spectra for cross prediction.
preprocessOptions : SpectralPreprocessingOptions
-
Information how to preprocess the data.
regress : MultivariateRegression
-
The type of regression (e.g. PCR, PLS1, PLS2) provided as an empty regression object.
crossPRESS : byref<IROVector<float>>
-
The vector of CROSS press values. Note that this vector has the length numFactor+1.
Returns: float
The mean number of spectra used for prediction.
|
Get the cross predicted error sum of squares for the number of factors=0...numFactors.
|
Full Usage:
MultivariateRegression.GetCrossPRESS(xOfX, X, Y, numFactors, groupingStrategy, preprocessOptions, regress, crossPRESS)
Parameters:
IReadOnlyList<float>
-
The spectral wavelength values corresponding to the spectral bins.
X : IROMatrix<float>
-
Matrix of spectra (a spectrum = a row in the matrix).
Y : IROMatrix<float>
-
Matrix of y values (e.g. concentrations).
numFactors : int
-
Maximum number of factors to calculate the cross PRESS for.
groupingStrategy : ICrossValidationGroupingStrategy
-
The strategy how to group the spectra for cross prediction.
preprocessOptions : SpectralPreprocessingOptions
-
Information how to preprocess the data.
regress : MultivariateRegression
-
The type of regression (e.g. PCR, PLS1, PLS2) provided as an empty regression object.
crossPRESS : byref<IROVector<float>>
-
The vector of CROSS press values. Note that this vector has the length numFactor+1.
Returns: float
The mean number of spectra used for prediction.
|
Get the cross predicted error sum of squares for the number of factors=0...numFactors.
|
Full Usage:
MultivariateRegression.GetCrossXResiduals(spectralRegions, X, Y, numFactors, groupingStrategy, preprocessOptions, regress, crossXResiduals)
Parameters:
int[]
-
Array of ascending indices representing the starting indices of spectral regions.
X : IROMatrix<float>
-
Matrix of spectra (a spectrum = a row in the matrix).
Y : IROMatrix<float>
-
Matrix of y values (e.g. concentrations).
numFactors : int
-
Number of factors used for calculation.
groupingStrategy : ICrossValidationGroupingStrategy
-
The strategy how to group the spectra for cross prediction.
preprocessOptions : SpectralPreprocessingOptions
-
Information how to preprocess the data.
regress : MultivariateRegression
-
The type of regression (e.g. PCR, PLS1, PLS2) provided as an empty regression object.
crossXResiduals : byref<IROMatrix<float>>
-
Returns the matrix of spectral residuals
Returns: float
Mean number of spectra used for prediction.
|
Calculates the spectral residuals obtained from cross validation.
|
Full Usage:
MultivariateRegression.GetCrossXResiduals(xOfX, X, Y, numFactors, groupingStrategy, preprocessOptions, regress, crossXResiduals)
Parameters:
IReadOnlyList<float>
-
The spectral wavelength values corresponding to the spectral bins.
X : IROMatrix<float>
-
Matrix of spectra (a spectrum = a row in the matrix).
Y : IROMatrix<float>
-
Matrix of y values (e.g. concentrations).
numFactors : int
-
Number of factors used for calculation.
groupingStrategy : ICrossValidationGroupingStrategy
-
The strategy how to group the spectra for cross prediction.
preprocessOptions : SpectralPreprocessingOptions
-
Information how to preprocess the data.
regress : MultivariateRegression
-
The type of regression (e.g. PCR, PLS1, PLS2) provided as an empty regression object.
crossXResiduals : byref<IROMatrix<float>>
-
Returns the matrix of spectral residuals
Returns: float
Mean number of spectra used for prediction.
|
Calculates the spectral residuals obtained from cross validation.
|
Full Usage:
MultivariateRegression.GetCrossYPredicted(spectralRegions, X, Y, numFactors, groupingStrategy, preprocessOptions, regress, yCrossPredicted)
Parameters:
int[]
-
Array of ascending indices representing the starting indices of spectral regions.
X : IROMatrix<float>
-
Matrix of spectra (a spectrum = a row in the matrix).
Y : IROMatrix<float>
-
Matrix of y values (e.g. concentrations).
numFactors : int
-
Number of factors used for calculation.
groupingStrategy : ICrossValidationGroupingStrategy
-
The strategy how to group the spectra for cross prediction.
preprocessOptions : SpectralPreprocessingOptions
-
Information how to preprocess the data.
regress : MultivariateRegression
-
The type of regression (e.g. PCR, PLS1, PLS2) provided as an empty regression object.
yCrossPredicted : IMatrix<float>
-
Matrix of cross predicted y values. Must be of same dimension as the Y matrix.
Returns: float
Mean number of spectra used for cross prediction.
|
Calculates the cross predicted y values.
|
Full Usage:
MultivariateRegression.GetCrossYPredicted(xOfX, X, Y, numFactors, groupingStrategy, preprocessOptions, regress, yCrossPredicted)
Parameters:
IReadOnlyList<float>
-
The spectral wavelength values corresponding to the spectral bins.
X : IROMatrix<float>
-
Matrix of spectra (a spectrum = a row in the matrix).
Y : IROMatrix<float>
-
Matrix of y values (e.g. concentrations).
numFactors : int
-
Number of factors used for calculation.
groupingStrategy : ICrossValidationGroupingStrategy
-
The strategy how to group the spectra for cross prediction.
preprocessOptions : SpectralPreprocessingOptions
-
Information how to preprocess the data.
regress : MultivariateRegression
-
The type of regression (e.g. PCR, PLS1, PLS2) provided as an empty regression object.
yCrossPredicted : IMatrix<float>
-
Matrix of cross predicted y values. Must be of same dimension as the Y matrix.
Returns: float
Mean number of spectra used for cross prediction.
|
Calculates the cross predicted y values.
|
Full Usage:
MultivariateRegression.PostprocessY(matrixY, meanY, scaleY)
Parameters:
IMatrix<float>
-
Matrix of (centered) y values. On return, contains the uncentered y values.
meanY : IReadOnlyList<float>
-
Vector of mean y value(s).
scaleY : IReadOnlyList<float>
-
Vector of y scale value(s).
|
This calculates from the predicted (but still centered) y values the raw y values.
|
Full Usage:
MultivariateRegression.PostprocessY(calib, matrixY)
Parameters:
IMultivariatePreprocessingModel
-
Contains the calibration data (mean y and scale y).
matrixY : IMatrix<float>
-
Matrix of (centered) y values. On return, contains the uncentered y values.
|
This calculates from the predicted (but still centered) y values the raw y values.
|
Full Usage:
MultivariateRegression.PreprocessForAnalysis(preprocessOptions, spectralRegions, matrixX, matrixY, meanX, scaleX, meanY, scaleY)
Parameters:
SpectralPreprocessingOptions
-
Information how to preprocess the data.
spectralRegions : int[]
-
Array of ascending indices representing the starting indices of spectral regions.
matrixX : IMatrix<float>
-
matrixY : IMatrix<float>
-
meanX : byref<IVector<float>>
-
scaleX : byref<IVector<float>>
-
meanY : byref<IVector<float>>
-
scaleY : byref<IVector<float>>
-
|
Preprocesses the x and y matrices before usage in multivariate calibrations.
|
Full Usage:
MultivariateRegression.PreprocessForAnalysis(preprocessOptions, xOfX, matrixX, matrixY, meanX, scaleX, meanY, scaleY)
Parameters:
SpectralPreprocessingOptions
-
Information how to preprocess the data.
xOfX : IReadOnlyList<float>
-
matrixX : IMatrix<float>
-
matrixY : IMatrix<float>
-
meanX : byref<IVector<float>>
-
scaleX : byref<IVector<float>>
-
meanY : byref<IVector<float>>
-
scaleY : byref<IVector<float>>
-
|
Preprocesses the x and y matrices before usage in multivariate calibrations.
|
Full Usage:
MultivariateRegression.PreprocessForAnalysis(preprocessOptions, spectralRegions, matrixX, matrixY)
Parameters:
SpectralPreprocessingOptions
-
Information how to preprocess the data.
spectralRegions : int[]
-
Array of ascending indices representing the starting indices of spectral regions.
matrixX : IMatrix<float>
-
Matrix of spectra.
matrixY : IMatrix<float>
-
Matrix of concentrations.
Returns: MultivariatePreprocessingModel
The collected data about proprocessing.
|
Preprocesses the x and y matrices before usage in multivariate calibrations.
|
Full Usage:
MultivariateRegression.PreprocessForAnalysis(preprocessOptions, xOfX, matrixX, matrixY)
Parameters:
SpectralPreprocessingOptions
-
Information how to preprocess the data.
xOfX : IReadOnlyList<float>
-
Spectral wavelength values.
matrixX : IMatrix<float>
-
Matrix of spectra.
matrixY : IMatrix<float>
-
Matrix of concentrations.
Returns: MultivariatePreprocessingModel
The collected data about proprocessing.
|
Preprocesses the x and y matrices before usage in multivariate calibrations.
|
Full Usage:
MultivariateRegression.PreprocessSpectraForAnalysis(preprocessOptions, spectralRegions, matrixX, meanX, scaleX)
Parameters:
SpectralPreprocessingOptions
-
Contains the information how to preprocess the spectra.
spectralRegions : int[]
-
Array of starting indices of spectral regions. Can be set to null.
matrixX : IMatrix<float>
-
The matrix of spectra. Each spectrum is a row of the matrix.
meanX : byref<IVector<float>>
-
scaleX : byref<IVector<float>>
-
|
This will process the spectra before analysis in multivariate calibration.
|
Full Usage:
MultivariateRegression.PreprocessSpectraForAnalysis(preprocessOptions, xOfX, matrixX, meanX, scaleX)
Parameters:
SpectralPreprocessingOptions
-
Contains the information how to preprocess the spectra.
xOfX : IReadOnlyList<float>
-
matrixX : IMatrix<float>
-
The matrix of spectra. Each spectrum is a row of the matrix.
meanX : byref<IVector<float>>
-
scaleX : byref<IVector<float>>
-
|
This will process the spectra before analysis in multivariate calibration.
|
Full Usage:
MultivariateRegression.PreprocessSpectraForPrediction(calib, preprocessOptions, matrixX)
Parameters:
IMultivariateCalibrationModel
-
The calibration model containing the instructions to process the spectra.
preprocessOptions : SpectralPreprocessingOptions
-
Contains the information how to preprocess the spectra.
matrixX : IMatrix<float>
-
The matrix of spectra. Each spectrum is a row of the matrix.
|
This will convert the raw spectra (horizontally in matrixX) to preprocessed spectra according to the calibration model.
|
Full Usage:
MultivariateRegression.PreprocessSpectraForPrediction(calib, matrixX)
Parameters:
IMultivariatePreprocessingModel
-
The preprocessing data.
matrixX : IMatrix<float>
-
Matrix of raw spectra. On return, contains the preprocessed spectra.
|
Preprocess the raw spectra for prediction (use the preprocess data from the analysis).
|
Full Usage:
MultivariateRegression.PreprocessSpectraForPrediction(preprocessOptions, matrixX, meanX, scaleX)
Parameters:
SpectralPreprocessingOptions
-
Information how to preprocess the spectra.
matrixX : IMatrix<float>
-
Matrix of raw spectra. On return, this matrix contains the preprocessed spectra.
meanX : IReadOnlyList<float>
-
Mean spectrum.
scaleX : IReadOnlyList<float>
-
Scale spectrum.
|
This will convert the raw spectra (horizontally in matrixX) to preprocessed spectra according to the calibration model.
|
Full Usage:
MultivariateRegression.PreprocessYForAnalysis(matrixY, meanY, scaleY)
Parameters:
IMatrix<float>
-
Matrix of y values. On return, this contains the preprocessed y values.
meanY : byref<IVector<float>>
-
On return, contains the mean y value(s).
scaleY : byref<IVector<float>>
-
On return, contains the scale value(s).
|
Preprocess the y values for analysis (mean center, scale currently not used). |
Full Usage:
MultivariateRegression.PreprocessYForPrediction(matrixY, meanY, scaleY)
Parameters:
IMatrix<float>
-
The concentration matrix. Constituents are horizontally oriented, different experiments vertically.
meanY : IReadOnlyList<float>
-
Vector of concentration mean values.
scaleY : IReadOnlyList<float>
-
Vector of concentration scale values.
|
This centers and scales the y values in exactly the way it was done in the multivariate analysis.
|