G02LDF (PDF version)
G02 Chapter Contents
G02 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

G02LDF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

G02LDF calculates predictions given the output from an orthogonal scores PLS regression (G02LAF or G02LBF) and G02LCF.

2  Specification

SUBROUTINE G02LDF ( IP, MY, ORIG, XBAR, YBAR, ISCALE, XSTD, YSTD, B, LDB, N, MZ, ISZ, Z, LDZ, YHAT, LDYHAT, IFAIL)
INTEGER  IP, MY, ORIG, ISCALE, LDB, N, MZ, ISZ(MZ), LDZ, LDYHAT, IFAIL
REAL (KIND=nag_wp)  XBAR(IP), YBAR(MY), XSTD(IP), YSTD(MY), B(LDB,MY), Z(LDZ,MZ), YHAT(LDYHAT,MY)

3  Description

G02LDF 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 G02LCF.
If G02LCF returns parameter estimates for the original data scale, no further information is required.
If G02LCF 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 G02LAF and G02LBF.

4  References

None.

5  Parameters

1:     IP – INTEGERInput
On entry: the number of predictor variables in the fitted model. IP must take the same value as that supplied to G02LAF or G02LBF to fit the model.
Constraint: IP>1.
2:     MY – INTEGERInput
On entry: the number of response variables in the fitted model. MY must take the same value as that supplied to G02LAF or G02LBF to fit the model.
Constraint: MY1.
3:     ORIG – INTEGERInput
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.
4:     XBAR(IP) – REAL (KIND=nag_wp) arrayInput
On entry: if ORIG=-1, XBAR must contain mean values of predictor variables in the model; otherwise XBAR is not referenced.
5:     YBAR(MY) – REAL (KIND=nag_wp) arrayInput
On entry: if ORIG=-1, YBAR must contain the mean value of each response variable in the model; otherwise YBAR is not referenced.
6:     ISCALE – INTEGERInput
On entry: if ORIG=-1, ISCALE must take the value supplied to either G02LAF or G02LBF; otherwise ISCALE is not referenced.
Constraint: if ORIG=-1, ISCALE=-1, 1 or 2.
7:     XSTD(IP) – REAL (KIND=nag_wp) arrayInput
On entry: if ORIG=-1 and ISCALE-1, XSTD must contain the scalings of predictor variables in the model as returned from either G02LAF or G02LBF; otherwise XSTD is not referenced.
8:     YSTD(MY) – REAL (KIND=nag_wp) arrayInput
On entry: if ORIG=-1 and ISCALE-1, YSTD must contain the scalings of response variables as returned from either G02LAF or G02LBF; otherwise YSTD is not referenced.
9:     B(LDB,MY) – REAL (KIND=nag_wp) arrayInput
On entry: if ORIG=-1, B must contain the parameter estimate for the centred, and possibly scaled, data as returned by G02LCF; otherwise B must contain the parameter estimates for the original data as returned by G02LCF.
10:   LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which G02LDF is called. If ORIG=-1, LDB must be at least IP; otherwise B also contains the estimate for the intercept parameter and consequently LDB must be at least 1+IP.
Constraints:
  • if ORIG=-1, LDBIP;
  • if ORIG=1, LDB1+IP.
11:   N – INTEGERInput
On entry: n, the number of observations in the test data Z.
Constraint: N1.
12:   MZ – INTEGERInput
On entry: the number of available predictor variables in the test data.
Constraint: MZIP.
13:   ISZ(MZ) – INTEGER arrayInput
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 ISZj=1, the jth predictor variable is included in the model, for j=1,2,,MZ, otherwise ISZj=0.
Constraints:
  • ISZj=0​ or ​1, for j=1,2,,MZ;
  • jISZj=IP.
14:   Z(LDZ,MZ) – REAL (KIND=nag_wp) arrayInput
On entry: Zij contains the ith observation on the jth available predictor variable, for i=1,2,,N and j=1,2,,MZ.
15:   LDZ – INTEGERInput
On entry: the first dimension of the array Z as declared in the (sub)program from which G02LDF is called.
Constraint: LDZN.
16:   YHAT(LDYHAT,MY) – REAL (KIND=nag_wp) arrayOutput
On exit: YHATij contains the ith predicted value of the jth y-variable in the model.
17:   LDYHAT – INTEGERInput
On entry: the first dimension of the array YHAT as declared in the (sub)program from which G02LDF is called.
Constraint: LDYHATN.
18:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
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,ORIG=-1 and LDB<IP,
orORIG=1 and LDB<1+IP,
orMZ<IP,
orLDZ<N,
orLDYHAT<N.
IFAIL=3
The sum of elements in ISZ does not equal IP.

7  Accuracy

Not applicable.

8  Further Comments

G02LDF allocates internally 3×IP+MY elements of real storage.

9  Example

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

9.1  Program Text

Program Text (g02ldfe.f90)

9.2  Program Data

Program Data (g02ldfe.d)

9.3  Program Results

Program Results (g02ldfe.r)


G02LDF (PDF version)
G02 Chapter Contents
G02 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012