g02la fits an orthogonal scores partial least squares (PLS) regression by using singular value decomposition.
Syntax
C# |
---|
public static void g02la( int n, int mx, double[,] x, int[] isx, int ip, int my, double[,] y, double[] xbar, double[] ybar, int iscale, double[] xstd, double[] ystd, int maxfac, double[,] xres, double[,] yres, double[,] w, double[,] p, double[,] t, double[,] c, double[,] u, double[] xcv, double[,] ycv, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g02la ( _ n As Integer, _ mx As Integer, _ x As Double(,), _ isx As Integer(), _ ip As Integer, _ my As Integer, _ y As Double(,), _ xbar As Double(), _ ybar As Double(), _ iscale As Integer, _ xstd As Double(), _ ystd As Double(), _ maxfac As Integer, _ xres As Double(,), _ yres As Double(,), _ w As Double(,), _ p As Double(,), _ t As Double(,), _ c As Double(,), _ u As Double(,), _ xcv As Double(), _ ycv As Double(,), _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g02la( int n, int mx, array<double,2>^ x, array<int>^ isx, int ip, int my, array<double,2>^ y, array<double>^ xbar, array<double>^ ybar, int iscale, array<double>^ xstd, array<double>^ ystd, int maxfac, array<double,2>^ xres, array<double,2>^ yres, array<double,2>^ w, array<double,2>^ p, array<double,2>^ t, array<double,2>^ c, array<double,2>^ u, array<double>^ xcv, array<double,2>^ ycv, [OutAttribute] int% ifail ) |
F# |
---|
static member g02la : n : int * mx : int * x : float[,] * isx : int[] * ip : int * my : int * y : float[,] * xbar : float[] * ybar : float[] * iscale : int * xstd : float[] * ystd : float[] * maxfac : int * xres : float[,] * yres : float[,] * w : float[,] * p : float[,] * t : float[,] * c : float[,] * u : float[,] * xcv : float[] * ycv : float[,] * ifail : int byref -> unit |
Parameters
- n
- Type: System..::..Int32On entry: , the number of observations.Constraint: .
- mx
- Type: System..::..Int32On entry: the number of predictor variables.Constraint: .
- x
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, mx]Note: dim1 must satisfy the constraint:On entry: must contain the th observation on the th predictor variable, for and .
- isx
- Type: array<System..::..Int32>[]()[][]An array of size [mx]On entry: indicates which predictor variables are to be included in the model.
- The th predictor variable (with variates in the th column of ) is included in the model.
- Otherwise.
- ip
- Type: System..::..Int32On entry: , the number of predictor variables in the model.Constraint: .
- my
- Type: System..::..Int32On entry: , the number of response variables.Constraint: .
- y
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, my]Note: dim1 must satisfy the constraint:On entry: must contain the th observation for the th response variable, for and .
- xbar
- Type: array<System..::..Double>[]()[][]An array of size [ip]On exit: mean values of predictor variables in the model.
- ybar
- Type: array<System..::..Double>[]()[][]An array of size [my]On exit: the mean value of each response variable.
- iscale
- Type: System..::..Int32On entry: indicates how predictor variables are scaled.
- Data are scaled by the standard deviation of variables.
- Data are scaled by user-supplied scalings.
- No scaling.
Constraint: , or .
- xstd
- Type: array<System..::..Double>[]()[][]An array of size [ip]On entry: if , must contain the user-supplied scaling for the th predictor variable in the model, for . Otherwise xstd need not be set.On exit: if , standard deviations of predictor variables in the model. Otherwise xstd is not changed.
- ystd
- Type: array<System..::..Double>[]()[][]An array of size [my]On entry: if , must contain the user-supplied scaling for the th response variable in the model, for . Otherwise ystd need not be set.On exit: if , the standard deviation of each response variable. Otherwise ystd is not changed.
- maxfac
- Type: System..::..Int32On entry: , the number of latent variables to calculate.Constraint: .
- xres
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, ip]Note: dim1 must satisfy the constraint:On exit: the predictor variables' residual matrix .
- yres
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, my]Note: dim1 must satisfy the constraint:On exit: the residuals for each response variable, .
- w
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, maxfac]Note: dim1 must satisfy the constraint:On exit: the th column of contains the -weights , for .
- p
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, maxfac]Note: dim1 must satisfy the constraint:On exit: the th column of contains the -loadings , for .
- t
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, maxfac]Note: dim1 must satisfy the constraint:On exit: the th column of contains the -scores , for .
- c
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, maxfac]Note: dim1 must satisfy the constraint:On exit: the th column of contains the -loadings , for .
- u
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, maxfac]Note: dim1 must satisfy the constraint:On exit: the th column of contains the -scores , for .
- xcv
- Type: array<System..::..Double>[]()[][]An array of size [maxfac]On exit: contains the cumulative percentage of variance in the predictor variables explained by the first factors, for .
- ycv
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, my]Note: dim1 must satisfy the constraint:On exit: is the cumulative percentage of variance of the th response variable explained by the first factors, for and .
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
Let be the mean-centred by data matrix of observations on predictor variables. Let be the mean-centred by data matrix of observations on response variables.
The first of the factors PLS methods extract from the data predicts both and by regressing on a column vector of scores:
where the column vectors of -loadings and -loadings are calculated in the least squares sense:
The -score vector is the linear combination of predictor data that has maximum covariance with the -scores , where the -weights vector is the normalised first left singular vector of .
The method extracts subsequent PLS factors by repeating the above process with the residual matrices:
and with orthogonal scores:
Optionally, in addition to being mean-centred, the data matrices and may be scaled by standard deviations of the variables. If data are supplied mean-centred, the calculations are not affected within numerical accuracy.
References
None.
Error Indicators and Warnings
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface
(LDX, LDY, LDXRES, LDYRES, LDW, LDP, LDT, LDC, LDU, LDYCV) In these
cases, an error in another parameter has usually caused an incorrect value to be inferred.
On entry, , or , or an element of or , or , or , or .
On entry, or , or or ,
Accuracy
The computed singular value decomposition is nearly the exact singular value decomposition for a nearby matrix , where
and is the machine precision.
Parallelism and Performance
None.
Further Comments
g02la allocates internally elements of real storage, where and .
Example
This example reads in data from an experiment to measure the biological activity in a chemical compound, and a PLS model is estimated.
Example program (C#): g02lae.cs