g02ld calculates predictions given the output from an orthogonal scores PLS regression (g02la or g02lb) and g02lc.

Syntax

C#
public static void g02ld(
	int ip,
	int my,
	int orig,
	double[] xbar,
	double[] ybar,
	int iscale,
	double[] xstd,
	double[] ystd,
	double[,] b,
	int n,
	int mz,
	int[] isz,
	double[,] z,
	double[,] yhat,
	out int ifail
)
Visual Basic
Public Shared Sub g02ld ( _
	ip As Integer, _
	my As Integer, _
	orig As Integer, _
	xbar As Double(), _
	ybar As Double(), _
	iscale As Integer, _
	xstd As Double(), _
	ystd As Double(), _
	b As Double(,), _
	n As Integer, _
	mz As Integer, _
	isz As Integer(), _
	z As Double(,), _
	yhat As Double(,), _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g02ld(
	int ip, 
	int my, 
	int orig, 
	array<double>^ xbar, 
	array<double>^ ybar, 
	int iscale, 
	array<double>^ xstd, 
	array<double>^ ystd, 
	array<double,2>^ b, 
	int n, 
	int mz, 
	array<int>^ isz, 
	array<double,2>^ z, 
	array<double,2>^ yhat, 
	[OutAttribute] int% ifail
)
F#
static member g02ld : 
        ip : int * 
        my : int * 
        orig : int * 
        xbar : float[] * 
        ybar : float[] * 
        iscale : int * 
        xstd : float[] * 
        ystd : float[] * 
        b : float[,] * 
        n : int * 
        mz : int * 
        isz : int[] * 
        z : float[,] * 
        yhat : float[,] * 
        ifail : int byref -> unit 

Parameters

ip
Type: System..::..Int32
On entry: the number of predictor variables in the fitted model. ip must take the same value as that supplied to g02la or g02lb to fit the model.
Constraint: ip>1.
my
Type: System..::..Int32
On entry: the number of response variables in the fitted model. my must take the same value as that supplied to g02la or g02lb to fit the model.
Constraint: my1.
orig
Type: System..::..Int32
On entry: indicates how parameter estimates are supplied.
orig=1
Parameter estimates are for the original data.
orig=-1
Parameter estimates are for the centred, and possibly scaled, data.
Constraint: orig=-1 or 1.
xbar
Type: array<System..::..Double>[]()[][]
An array of size [ip]
On entry: if orig=-1, xbar must contain mean values of predictor variables in the model; otherwise xbar is not referenced.
ybar
Type: array<System..::..Double>[]()[][]
An array of size [my]
On entry: if orig=-1, ybar must contain the mean value of each response variable in the model; otherwise ybar is not referenced.
iscale
Type: System..::..Int32
On entry: if orig=-1, iscale must take the value supplied to either g02la or g02lb; otherwise iscale is not referenced.
Constraint: if orig=-1, iscale=-1, 1 or 2.
xstd
Type: array<System..::..Double>[]()[][]
An array of size [ip]
On entry: if orig=-1 and iscale-1, xstd must contain the scalings of predictor variables in the model as returned from either g02la or g02lb; otherwise xstd is not referenced.
ystd
Type: array<System..::..Double>[]()[][]
An array of size [my]
On entry: if orig=-1 and iscale-1, ystd must contain the scalings of response variables as returned from either g02la or g02lb; otherwise ystd is not referenced.
b
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, my]
Note: dim1 must satisfy the constraint:
  • if orig=-1, dim1ip;
  • if orig=1, dim11+ip.
On entry: if orig=-1, b must contain the parameter estimate for the centred, and possibly scaled, data as returned by g02lc; otherwise b must contain the parameter estimates for the original data as returned by g02lc.
n
Type: System..::..Int32
On entry: n, the number of observations in the test data Z.
Constraint: n1.
mz
Type: System..::..Int32
On entry: the number of available predictor variables in the test data.
Constraint: mzip.
isz
Type: array<System..::..Int32>[]()[][]
An array of size [mz]
On entry: indicates which predictor variables are to be included in the model. Predictor variables included from z must be in the same order as those included in the fitted model.
If isz[j-1]=1, the jth predictor variable is included in the model, for j=1,2,,mz, otherwise isz[j-1]=0.
Constraints:
  • isz[j-1]=0​ or ​1, for j=1,2,,mz;
  • jisz[j-1]=ip.
z
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, mz]
Note: dim1 must satisfy the constraint: dim1n
On entry: z[i-1,j-1] contains the ith observation on the jth available predictor variable, for i=1,2,,n and j=1,2,,mz.
yhat
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, my]
Note: dim1 must satisfy the constraint: dim1n
On exit: yhat[i-1,j-1] contains the ith predicted value of the jth y-variable in the model.
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

g02ld calculates the predictions Y^ of a PLS model given a set Z of test data and a set B of parameter estimates as returned by g02lc.
If g02lc returns parameter estimates for the original data scale, no further information is required.
If g02lc returns parameter estimates for the centred, and possibly scaled, data, further information is required. The means of variables in the fitted model must be supplied. In the case of a PLS model fitted by using scaled data, the means and standard deviations of variables in the fitted model must also be supplied. These means and standard deviations are those returned by either g02la and g02lb.

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 (LDB, LDZ, LDYHAT) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
ifail=1
On entry,ip1,
ormy<1,
ororig-1 or 1,
ororig=-1 and iscale-1, 1 or 2,
orn<1,
oran element of isz0 or 1.
ifail=2
On entry,mz<ip,
ifail=3
The sum of elements in isz does not equal ip.
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

Not applicable.

Parallelism and Performance

None.

Further Comments

g02ld allocates internally 3×ip+my elements of real storage.

Example

This example reads in parameter estimates for a fitted PLS model and prediction data, and the PLS model predictions are calculated.

Example program (C#): g02lde.cs

Example program data: g02lde.d

Example program results: g02lde.r

See Also