NAG CL Interface
g02ldc (pls_​pred)

1 Purpose

g02ldc calculates predictions given the output from an orthogonal scores PLS regression (g02lac or g02lbc) and g02lcc.

2 Specification

#include <nag.h>
void  g02ldc (Nag_OrderType order, Integer ip, Integer my, Nag_EstimatesOption orig, const double xbar[], const double ybar[], Nag_ScalePredictor iscale, const double xstd[], const double ystd[], const double b[], Integer pdb, Integer n, Integer mz, const Integer isz[], const double z[], Integer pdz, double yhat[], Integer pdyhat, NagError *fail)
The function may be called by the names: g02ldc, nag_correg_pls_pred or nag_pls_orth_scores_pred.

3 Description

g02ldc 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 g02lcc.
If g02lcc returns parameter estimates for the original data scale, no further information is required.
If g02lcc 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 g02lac and g02lbc.

4 References

None.

5 Arguments

1: order Nag_OrderType Input
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2: ip Integer Input
On entry: the number of predictor variables in the fitted model. ip must take the same value as that supplied to g02lac or g02lbc to fit the model.
Constraint: ip>1.
3: my Integer Input
On entry: the number of response variables in the fitted model. my must take the same value as that supplied to g02lac or g02lbc to fit the model.
Constraint: my1.
4: orig Nag_EstimatesOption Input
On entry: indicates how parameter estimates are supplied.
orig=Nag_EstimatesOrig
Parameter estimates are for the original data.
orig=Nag_EstimatesStand
Parameter estimates are for the centred, and possibly scaled, data.
Constraint: orig=Nag_EstimatesStand or Nag_EstimatesOrig.
5: xbar[ip] const double Input
On entry: if orig=Nag_EstimatesStand, xbar must contain mean values of predictor variables in the model; otherwise xbar is not referenced.
6: ybar[my] const double Input
On entry: if orig=Nag_EstimatesStand, ybar must contain the mean value of each response variable in the model; otherwise ybar is not referenced.
7: iscale Nag_ScalePredictor Input
On entry: if orig=Nag_EstimatesStand, iscale must take the value supplied to either g02lac or g02lbc; otherwise iscale is not referenced.
Constraint: if orig=Nag_EstimatesStand, iscale=Nag_PredNoScale, Nag_PredStdScale or Nag_PredUserScale.
8: xstd[ip] const double Input
On entry: if orig=Nag_EstimatesStand and iscaleNag_PredNoScale, xstd must contain the scalings of predictor variables in the model as returned from either g02lac or g02lbc; otherwise xstd is not referenced.
9: ystd[my] const double Input
On entry: if orig=Nag_EstimatesStand and iscaleNag_PredNoScale, ystd must contain the scalings of response variables as returned from either g02lac or g02lbc; otherwise ystd is not referenced.
10: b[dim] const double Input
Note: the dimension, dim, of the array b must be at least
  • max1,pdb×my when order=Nag_ColMajor;
  • max1,ip×pdb when order=Nag_RowMajor and orig=Nag_EstimatesStand;
  • max1,1+ip×pdb when order=Nag_RowMajor and orig=Nag_EstimatesOrig.
the i,jth element of the matrix B is stored in
  • b[j-1×pdb+i-1] when order=Nag_ColMajor;
  • b[i-1×pdb+j-1] when order=Nag_RowMajor.
On entry: if orig=Nag_EstimatesStand, b must contain the parameter estimate for the centred, and possibly scaled, data as returned by g02lcc; otherwise b must contain the parameter estimates for the original data as returned by g02lcc.
11: pdb Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array b.
Constraints:
  • if order=Nag_ColMajor,
    • if orig=Nag_EstimatesStand, pdbip;
    • if orig=Nag_EstimatesOrig, pdb1+ip;
  • if order=Nag_RowMajor, pdbmy.
12: n Integer Input
On entry: n, the number of observations in the test data Z.
Constraint: n1.
13: mz Integer Input
On entry: the number of available predictor variables in the test data.
Constraint: mzip.
14: isz[mz] const Integer 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]=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.
15: z[dim] const double Input
Note: the dimension, dim, of the array z must be at least
  • max1,pdz×mz when order=Nag_ColMajor;
  • max1,n×pdz when order=Nag_RowMajor.
where Zi,j appears in this document, it refers to the array element
  • z[j-1×pdz+i-1] when order=Nag_ColMajor;
  • z[i-1×pdz+j-1] when order=Nag_RowMajor.
On entry: Zi,j contains the ith observation on the jth available predictor variable, for i=1,2,,n and j=1,2,,mz.
16: pdz Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array z.
Constraints:
  • if order=Nag_ColMajor, pdzn;
  • if order=Nag_RowMajor, pdzmz.
17: yhat[dim] double Output
Note: the dimension, dim, of the array yhat must be at least
  • max1,pdyhat×my when order=Nag_ColMajor;
  • max1,n×pdyhat when order=Nag_RowMajor.
where YHATi,j appears in this document, it refers to the array element
  • yhat[j-1×pdyhat+i-1] when order=Nag_ColMajor;
  • yhat[i-1×pdyhat+j-1] when order=Nag_RowMajor.
On exit: YHATi,j contains the ith predicted value of the jth y-variable in the model.
18: pdyhat Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array yhat.
Constraints:
  • if order=Nag_ColMajor, pdyhatn;
  • if order=Nag_RowMajor, pdyhatmy.
19: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_ENUM_CHARACTER
On entry, iscale=value.
Constraint: if orig=Nag_EstimatesStand, iscale=Nag_PredNoScale, Nag_PredStdScale or Nag_PredUserScale.
NE_INT
On entry, ip=value.
Constraint: ip>1.
On entry, my=value.
Constraint: my1.
On entry, n=value.
Constraint: n1.
On entry, pdb=value.
Constraint: pdb>0.
On entry, pdyhat=value.
Constraint: pdyhat>0.
On entry, pdz=value.
Constraint: pdz>0.
NE_INT_2
On entry, mz=value and ip=value.
Constraint: mzip.
On entry, pdb=value and ip+1=value.
Constraint: if orig=Nag_EstimatesOrig, pdb1+ip.
On entry, pdb=value and ip=value.
Constraint: if orig=Nag_EstimatesStand, pdbip.
On entry, pdb=value and my=value.
Constraint: pdbmy.
On entry, pdyhat=value and my=value.
Constraint: pdyhatmy.
On entry, pdyhat=value and n=value.
Constraint: pdyhatn.
On entry, pdz=value and mz=value.
Constraint: pdzmz.
On entry, pdz=value and n=value.
Constraint: pdzn.
NE_INT_ARG_CONS
On entry, the number of elements of isz equal to 1 is not ip.
NE_INT_ARRAY_VAL_1_OR_2
On entry, isz[value]=value.
Constraint: isz[j-1]=0 or 1.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

g02ldc 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments

g02ldc allocates internally 3×ip+my elements of double 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 (g02ldce.c)

10.2 Program Data

Program Data (g02ldce.d)

10.3 Program Results

Program Results (g02ldce.r)