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:     XBARIP – 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:     YBARMY – 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:     XSTDIP – 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:     YSTDMY – 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:     BLDBMY – 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:   ISZMZ – 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:   ZLDZMZ – 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:   YHATLDYHATMY – 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, IP=value.
Constraint: IP>1.
On entry, ISCALE=value.
Constraint: if ORIG=-1, ISCALE=-1, 1 or 2.
On entry, ISZj=value, j=value.
Constraint: ISZj=0​ or ​1.
On entry, MY=value.
Constraint: MY1.
On entry, N=value.
Constraint: N1.
On entry, ORIG=value.
Constraint: ORIG=-1 or 1.
IFAIL=2
On entry, LDB=value and IP=value.
Constraint: if ORIG=-1, LDBIP.
On entry, LDB=value and IP+1=value.
Constraint: if ORIG=1, LDB1+IP.
On entry, LDYHAT=value and N=value.
Constraint: LDYHATN.
On entry, LDZ=value and N=value.
Constraint: LDZN.
On entry, MZ=value and IP=value.
Constraint: MZIP.
IFAIL=3
On entry, the number of elements of ISZ equal to 1 is not IP.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

Not applicable.

8  Parallelism and Performance

G02LDF is not threaded by NAG in any implementation.
G02LDF makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9  Further Comments

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

10  Example

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

10.1  Program Text

Program Text (g02ldfe.f90)

10.2  Program Data

Program Data (g02ldfe.d)

10.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. 2015