g02lb fits an orthogonal scores partial least squares (PLS) regression by using Wold's iterative method.

Syntax

C#
public static void g02lb(
	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,
	int maxit,
	double tau,
	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 g02lb ( _
	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, _
	maxit As Integer, _
	tau As Double, _
	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 g02lb(
	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, 
	int maxit, 
	double tau, 
	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 g02lb : 
        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 * 
        maxit : int * 
        tau : float * 
        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.
maxit
Type: System..::..Int32
On entry: if my=1, maxit is not referenced; otherwise the maximum number of iterations used to calculate the x-weights.
Suggested value: maxit=200.
Constraint: if my>1, maxit>1.
tau
Type: System..::..Double
On entry: if my=1, tau is not referenced; otherwise the iterative procedure used to calculate the x-weights will halt if the Euclidean distance between two subsequent estimates is less than or equal to tau.
Suggested value: tau=1.0E−4.
Constraint: if my>1, tau>0.0.
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 a t1 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

Wold H (1966) Estimation of principal components and related models by iterative least squares In: Multivariate Analysis (ed P R Krishnaiah) 391–420 Academic Press NY

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,
ormy>1 and maxit1,
ormy>1 and tau0.0,
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

In general, the iterative method used in the calculations is less accurate (but faster) than the singular value decomposition approach adopted by g02la.

Parallelism and Performance

None.

Further Comments

g02lb allocates internally (n+r) elements of real storage.

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#): g02lbe.cs

Example program data: g02lbe.d

Example program results: g02lbe.r

See Also