NAG FL Interface
g02ldf (pls_​pred)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

g02ldf calculates predictions given the output from an orthogonal scores PLS regression (g02laf or g02lbf) and g02lcf.

2 Specification

Fortran Interface
Subroutine g02ldf ( ip, my, orig, xbar, ybar, iscale, xstd, ystd, b, ldb, n, mz, isz, z, ldz, yhat, ldyhat, ifail)
Integer, Intent (In) :: ip, my, orig, iscale, ldb, n, mz, isz(mz), ldz, ldyhat
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: xbar(ip), ybar(my), xstd(ip), ystd(my), b(ldb,my), z(ldz,mz)
Real (Kind=nag_wp), Intent (Inout) :: yhat(ldyhat,my)
C Header Interface
#include <nag.h>
void  g02ldf_ (const Integer *ip, const Integer *my, const Integer *orig, const double xbar[], const double ybar[], const Integer *iscale, const double xstd[], const double ystd[], const double b[], const Integer *ldb, const Integer *n, const Integer *mz, const Integer isz[], const double z[], const Integer *ldz, double yhat[], const Integer *ldyhat, Integer *ifail)
The routine may be called by the names g02ldf or nagf_correg_pls_pred.

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 Arguments

1: ip Integer Input
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 Integer Input
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 Integer Input
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) array Input
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) array Input
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 Integer Input
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) array Input
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) array Input
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) array Input
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 Integer Input
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 Integer Input
On entry: n, the number of observations in the test data Z.
Constraint: n1.
12: mz Integer Input
On entry: the number of available predictor variables in the test data.
Constraint: mzip.
13: isz(mz) Integer array Input
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, the jth predictor variable is included in the model, for j=1,2,,mz, otherwise isz(j)=0.
Constraints:
  • isz(j)=0​ or ​1, for j=1,2,,mz;
  • jisz(j)=ip.
14: z(ldz,mz) Real (Kind=nag_wp) array Input
On entry: z(i,j) contains the ith observation on the jth available predictor variable, for i=1,2,,n and j=1,2,,mz.
15: ldz Integer Input
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) array Output
On exit: yhat(i,j) contains the ith predicted value of the jth y-variable in the model.
17: ldyhat Integer Input
On entry: the first dimension of the array yhat as declared in the (sub)program from which g02ldf is called.
Constraint: ldyhatn.
18: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. 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, isz(value)=value.
Constraint: isz(j)=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 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
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)