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..::..Int32
On entry: n, the number of observations.
Constraint: n>1.
mx
Type: System..::..Int32
On entry: the number of predictor variables.
Constraint: mx>1.
x
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, mx]
Note: dim1 must satisfy the constraint: dim1n
On entry: x[i-1,j-1] must contain the ith observation on the jth predictor variable, for i=1,2,,n and j=1,2,,mx.
isx
Type: array<System..::..Int32>[]()[][]
An array of size [mx]
On entry: indicates which predictor variables are to be included in the model.
isx[j-1]=1
The jth predictor variable (with variates in the jth column of X) is included in the model.
isx[j-1]=0
Otherwise.
Constraint: the sum of elements in isx must equal ip.
ip
Type: System..::..Int32
On entry: m, the number of predictor variables in the model.
Constraint: 1<ipmx.
my
Type: System..::..Int32
On entry: r, the number of response variables.
Constraint: my1.
y
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, my]
Note: dim1 must satisfy the constraint: dim1n
On entry: y[i-1,j-1] must contain the ith observation for the jth response variable, for i=1,2,,n and j=1,2,,my.
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..::..Int32
On entry: indicates how predictor variables are scaled.
iscale=1
Data are scaled by the standard deviation of variables.
iscale=2
Data are scaled by user-supplied scalings.
iscale=-1
No scaling.
Constraint: iscale=-1, 1 or 2.
xstd
Type: array<System..::..Double>[]()[][]
An array of size [ip]
On entry: if iscale=2, xstd[j-1] must contain the user-supplied scaling for the jth predictor variable in the model, for j=1,2,,ip. Otherwise xstd need not be set.
On exit: if iscale=1, 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 iscale=2, ystd[j-1] must contain the user-supplied scaling for the jth response variable in the model, for j=1,2,,my. Otherwise ystd need not be set.
On exit: if iscale=1, the standard deviation of each response variable. Otherwise ystd is not changed.
maxfac
Type: System..::..Int32
On entry: k, the number of latent variables to calculate.
Constraint: 1maxfacip.
xres
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, ip]
Note: dim1 must satisfy the constraint: dim1n
On exit: the predictor variables' residual matrix Xk.
yres
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, my]
Note: dim1 must satisfy the constraint: dim1n
On exit: the residuals for each response variable, Yk.
w
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, maxfac]
Note: dim1 must satisfy the constraint: dim1ip
On exit: the jth column of W contains the x-weights wj, for j=1,2,,maxfac.
p
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, maxfac]
Note: dim1 must satisfy the constraint: dim1ip
On exit: the jth column of P contains the x-loadings pj, for j=1,2,,maxfac.
t
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, maxfac]
Note: dim1 must satisfy the constraint: dim1n
On exit: the jth column of T contains the x-scores tj, for j=1,2,,maxfac.
c
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, maxfac]
Note: dim1 must satisfy the constraint: dim1my
On exit: the jth column of C contains the y-loadings cj, for j=1,2,,maxfac.
u
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, maxfac]
Note: dim1 must satisfy the constraint: dim1n
On exit: the jth column of U contains the y-scores uj, for j=1,2,,maxfac.
xcv
Type: array<System..::..Double>[]()[][]
An array of size [maxfac]
On exit: xcv[j-1] contains the cumulative percentage of variance in the predictor variables explained by the first j factors, for j=1,2,,maxfac.
ycv
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, my]
Note: dim1 must satisfy the constraint: dim1maxfac
On exit: ycv[i-1,j-1] is the cumulative percentage of variance of the jth response variable explained by the first i factors, for i=1,2,,maxfac and j=1,2,,my.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

Let X1 be the mean-centred n by m data matrix X of n observations on m predictor variables. Let Y1 be the mean-centred n by r data matrix Y of n observations on r response variables.
The first of the k factors PLS methods extract from the data predicts both X1 and Y1 by regressing on t1 a column vector of n scores:
X^1=t1p1TY^1=t1c1T,with ​t1Tt1=1,
where the column vectors of m x-loadings p1 and r y-loadings c1 are calculated in the least squares sense:
p1T=t1TX1c1T=t1TY1.
The x-score vector t1=X1w1 is the linear combination of predictor data X1 that has maximum covariance with the y-scores u1=Y1c1, where the x-weights vector w1 is the normalised first left singular vector of X1TY1.
The method extracts subsequent PLS factors by repeating the above process with the residual matrices:
Xi=Xi-1-X^i-1Yi=Yi-1-Y^i-1,i=2,3,,k,
and with orthogonal scores:
tiTtj=0,j=1,2,,i-1.
Optionally, in addition to being mean-centred, the data matrices X1 and Y1 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.
ifail=1
On entry,n<2,
ormx<2,
oran element of isx0 or 1,
ormy<1,
oriscale-1, 1 or 2.
ifail=2
On entry,ip<2 or ip>mx,
ormaxfac<1 or maxfac>ip,
ifail=3
ip does not equal the sum of elements in isx.
ifail=-9000
An error occured, see message report.
ifail=-6000
Invalid Parameters value
ifail=-4000
Invalid dimension for array value
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

The computed singular value decomposition is nearly the exact singular value decomposition for a nearby matrix A+E, where
E2=OεA2,
and ε is the machine precision.

Parallelism and Performance

None.

Further Comments

g02la allocates internally 2mr+A+max3A+B,5A+r elements of real storage, where A=minm,r and B=maxm,r.

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

Example program data: g02lae.d

Example program results: g02lae.r

See Also