g02 Chapter Contents
g02 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_pls_orth_scores_svd (g02lac)

## 1  Purpose

nag_pls_orth_scores_svd (g02lac) fits an orthogonal scores partial least squares (PLS) regression by using singular value decomposition.

## 2  Specification

 #include #include
 void nag_pls_orth_scores_svd (Nag_OrderType order, Integer n, Integer mx, const double x[], Integer pdx, const Integer isx[], Integer ip, Integer my, const double y[], Integer pdy, double xbar[], double ybar[], Nag_ScalePredictor iscale, double xstd[], double ystd[], Integer maxfac, double xres[], Integer pdxres, double yres[], Integer pdyres, double w[], Integer pdw, double p[], Integer pdp, double t[], Integer pdt, double c[], Integer pdc, double u[], Integer pdu, double xcv[], double ycv[], Integer pdycv, NagError *fail)

## 3  Description

Let ${X}_{1}$ be the mean-centred $n$ by $m$ data matrix $X$ of $n$ observations on $m$ predictor variables. Let ${Y}_{1}$ be the mean-centred $n$ by $r$ data matrix $Y$ of $n$ observations on $r$ response variables.
The first of the $k$ factors PLS methods extract from the data predicts both ${X}_{1}$ and ${Y}_{1}$ by regressing on ${t}_{1}$ a column vector of $n$ scores:
 $X^1 = t1 p1T Y^1 = t1 c1T , with ​ t1T t1 = 1 ,$
where the column vectors of $m$ $x$-loadings ${p}_{1}$ and $r$ $y$-loadings ${c}_{1}$ are calculated in the least squares sense:
 $p1T = t1T X1 c1T = t1T Y1 .$
The $x$-score vector ${t}_{1}={X}_{1}{w}_{1}$ is the linear combination of predictor data ${X}_{1}$ that has maximum covariance with the $y$-scores ${u}_{1}={Y}_{1}{c}_{1}$, where the $x$-weights vector ${w}_{1}$ is the normalised first left singular vector of ${X}_{1}^{\mathrm{T}}{Y}_{1}$.
The method extracts subsequent PLS factors by repeating the above process with the residual matrices:
 $Xi = Xi-1 - X^ i-1 Yi = Yi-1 - Y^ i-1 , i=2,3,…,k ,$
and with orthogonal scores:
 $tiT tj = 0 , j=1,2,…,i-1 .$
Optionally, in addition to being mean-centred, the data matrices ${X}_{1}$ and ${Y}_{1}$ may be scaled by standard deviations of the variables. If data are supplied mean-centred, the calculations are not affected within numerical accuracy.

None.

## 5  Arguments

1:     orderNag_OrderTypeInput
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 ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or Nag_ColMajor.
2:     nIntegerInput
On entry: $n$, the number of observations.
Constraint: ${\mathbf{n}}>1$.
3:     mxIntegerInput
On entry: the number of predictor variables.
Constraint: ${\mathbf{mx}}>1$.
4:     x[$\mathit{dim}$]const doubleInput
Note: the dimension, dim, of the array x must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdx}}×{\mathbf{mx}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdx}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
Where ${\mathbf{X}}\left(i,j\right)$ appears in this document, it refers to the array element
• ${\mathbf{x}}\left[\left(j-1\right)×{\mathbf{pdx}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{x}}\left[\left(i-1\right)×{\mathbf{pdx}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: ${\mathbf{X}}\left(\mathit{i},\mathit{j}\right)$ must contain the $\mathit{i}$th observation on the $\mathit{j}$th predictor variable, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$ and $\mathit{j}=1,2,\dots ,{\mathbf{mx}}$.
5:     pdxIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array x.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdx}}\ge {\mathbf{n}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdx}}\ge {\mathbf{mx}}$.
6:     isx[mx]const IntegerInput
On entry: indicates which predictor variables are to be included in the model.
${\mathbf{isx}}\left[j-1\right]=1$
The $j$th predictor variable (with variates in the $j$th column of $X$) is included in the model.
${\mathbf{isx}}\left[j-1\right]=0$
Otherwise.
Constraint: the sum of elements in isx must equal ip.
7:     ipIntegerInput
On entry: $m$, the number of predictor variables in the model.
Constraint: $1<{\mathbf{ip}}\le {\mathbf{mx}}$.
8:     myIntegerInput
On entry: $r$, the number of response variables.
Constraint: ${\mathbf{my}}\ge 1$.
9:     y[$\mathit{dim}$]const doubleInput
Note: the dimension, dim, of the array y must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdy}}×{\mathbf{my}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdy}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
Where ${\mathbf{Y}}\left(i,j\right)$ appears in this document, it refers to the array element
• ${\mathbf{y}}\left[\left(j-1\right)×{\mathbf{pdy}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{y}}\left[\left(i-1\right)×{\mathbf{pdy}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: ${\mathbf{Y}}\left(\mathit{i},\mathit{j}\right)$ must contain the $\mathit{i}$th observation for the $\mathit{j}$th response variable, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$ and $\mathit{j}=1,2,\dots ,{\mathbf{my}}$.
10:   pdyIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array y.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdy}}\ge {\mathbf{n}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdy}}\ge {\mathbf{my}}$.
11:   xbar[ip]doubleOutput
On exit: mean values of predictor variables in the model.
12:   ybar[my]doubleOutput
On exit: the mean value of each response variable.
13:   iscaleNag_ScalePredictorInput
On entry: indicates how predictor variables are scaled.
${\mathbf{iscale}}=\mathrm{Nag_PredStdScale}$
Data are scaled by the standard deviation of variables.
${\mathbf{iscale}}=\mathrm{Nag_PredUserScale}$
Data are scaled by user-supplied scalings.
${\mathbf{iscale}}=\mathrm{Nag_PredNoScale}$
No scaling.
Constraint: ${\mathbf{iscale}}=\mathrm{Nag_PredNoScale}$, $\mathrm{Nag_PredStdScale}$ or $\mathrm{Nag_PredUserScale}$.
14:   xstd[ip]doubleInput/Output
On entry: if ${\mathbf{iscale}}=\mathrm{Nag_PredUserScale}$, ${\mathbf{xstd}}\left[\mathit{j}-1\right]$ must contain the user-supplied scaling for the $\mathit{j}$th predictor variable in the model, for $\mathit{j}=1,2,\dots ,{\mathbf{ip}}$. Otherwise xstd need not be set.
On exit: if ${\mathbf{iscale}}=\mathrm{Nag_PredStdScale}$, standard deviations of predictor variables in the model. Otherwise xstd is not changed.
15:   ystd[my]doubleInput/Output
On entry: if ${\mathbf{iscale}}=\mathrm{Nag_PredUserScale}$, ${\mathbf{ystd}}\left[\mathit{j}-1\right]$ must contain the user-supplied scaling for the $\mathit{j}$th response variable in the model, for $\mathit{j}=1,2,\dots ,{\mathbf{my}}$. Otherwise ystd need not be set.
On exit: if ${\mathbf{iscale}}=\mathrm{Nag_PredStdScale}$, the standard deviation of each response variable. Otherwise ystd is not changed.
16:   maxfacIntegerInput
On entry: $k$, the number of latent variables to calculate.
Constraint: $1\le {\mathbf{maxfac}}\le {\mathbf{ip}}$.
17:   xres[$\mathit{dim}$]doubleOutput
Note: the dimension, dim, of the array xres must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdxres}}×{\mathbf{ip}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdxres}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix is stored in
• ${\mathbf{xres}}\left[\left(j-1\right)×{\mathbf{pdxres}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{xres}}\left[\left(i-1\right)×{\mathbf{pdxres}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the predictor variables' residual matrix ${X}_{k}$.
18:   pdxresIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array xres.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdxres}}\ge {\mathbf{n}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdxres}}\ge {\mathbf{ip}}$.
19:   yres[$\mathit{dim}$]doubleOutput
Note: the dimension, dim, of the array yres must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdyres}}×{\mathbf{my}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdyres}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix is stored in
• ${\mathbf{yres}}\left[\left(j-1\right)×{\mathbf{pdyres}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{yres}}\left[\left(i-1\right)×{\mathbf{pdyres}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the residuals for each response variable, ${Y}_{k}$.
20:   pdyresIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array yres.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdyres}}\ge {\mathbf{n}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdyres}}\ge {\mathbf{my}}$.
21:   w[$\mathit{dim}$]doubleOutput
Note: the dimension, dim, of the array w must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdw}}×{\mathbf{maxfac}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{ip}}×{\mathbf{pdw}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $W$ is stored in
• ${\mathbf{w}}\left[\left(j-1\right)×{\mathbf{pdw}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{w}}\left[\left(i-1\right)×{\mathbf{pdw}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the $\mathit{j}$th column of $W$ contains the $x$-weights ${w}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{maxfac}}$.
22:   pdwIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array w.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdw}}\ge {\mathbf{ip}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdw}}\ge {\mathbf{maxfac}}$.
23:   p[$\mathit{dim}$]doubleOutput
Note: the dimension, dim, of the array p must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdp}}×{\mathbf{maxfac}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{ip}}×{\mathbf{pdp}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $P$ is stored in
• ${\mathbf{p}}\left[\left(j-1\right)×{\mathbf{pdp}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{p}}\left[\left(i-1\right)×{\mathbf{pdp}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the $\mathit{j}$th column of $P$ contains the $x$-loadings ${p}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{maxfac}}$.
24:   pdpIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array p.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdp}}\ge {\mathbf{ip}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdp}}\ge {\mathbf{maxfac}}$.
25:   t[$\mathit{dim}$]doubleOutput
Note: the dimension, dim, of the array t must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdt}}×{\mathbf{maxfac}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdt}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $T$ is stored in
• ${\mathbf{t}}\left[\left(j-1\right)×{\mathbf{pdt}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{t}}\left[\left(i-1\right)×{\mathbf{pdt}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the $\mathit{j}$th column of $T$ contains the $x$-scores ${t}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{maxfac}}$.
26:   pdtIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array t.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdt}}\ge {\mathbf{n}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdt}}\ge {\mathbf{maxfac}}$.
27:   c[$\mathit{dim}$]doubleOutput
Note: the dimension, dim, of the array c must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdc}}×{\mathbf{maxfac}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{my}}×{\mathbf{pdc}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $C$ is stored in
• ${\mathbf{c}}\left[\left(j-1\right)×{\mathbf{pdc}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{c}}\left[\left(i-1\right)×{\mathbf{pdc}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the $\mathit{j}$th column of $C$ contains the $y$-loadings ${c}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{maxfac}}$.
28:   pdcIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array c.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdc}}\ge {\mathbf{my}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdc}}\ge {\mathbf{maxfac}}$.
29:   u[$\mathit{dim}$]doubleOutput
Note: the dimension, dim, of the array u must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdu}}×{\mathbf{maxfac}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdu}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
The $\left(i,j\right)$th element of the matrix $U$ is stored in
• ${\mathbf{u}}\left[\left(j-1\right)×{\mathbf{pdu}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{u}}\left[\left(i-1\right)×{\mathbf{pdu}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: the $\mathit{j}$th column of $U$ contains the $y$-scores ${u}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{maxfac}}$.
30:   pduIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array u.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdu}}\ge {\mathbf{n}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdu}}\ge {\mathbf{maxfac}}$.
31:   xcv[maxfac]doubleOutput
On exit: ${\mathbf{xcv}}\left[\mathit{j}-1\right]$ contains the cumulative percentage of variance in the predictor variables explained by the first $\mathit{j}$ factors, for $\mathit{j}=1,2,\dots ,{\mathbf{maxfac}}$.
32:   ycv[$\mathit{dim}$]doubleOutput
Note: the dimension, dim, of the array ycv must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdycv}}×{\mathbf{my}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{maxfac}}×{\mathbf{pdycv}}\right)$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
Where ${\mathbf{YCV}}\left(i,j\right)$ appears in this document, it refers to the array element
• ${\mathbf{ycv}}\left[\left(j-1\right)×{\mathbf{pdycv}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{ycv}}\left[\left(i-1\right)×{\mathbf{pdycv}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On exit: ${\mathbf{YCV}}\left(\mathit{i},\mathit{j}\right)$ is the cumulative percentage of variance of the $\mathit{j}$th response variable explained by the first $\mathit{i}$ factors, for $\mathit{i}=1,2,\dots ,{\mathbf{maxfac}}$ and $\mathit{j}=1,2,\dots ,{\mathbf{my}}$.
33:   pdycvIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array ycv.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdycv}}\ge {\mathbf{maxfac}}$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdycv}}\ge {\mathbf{my}}$.
34:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{mx}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{mx}}>1$.
On entry, ${\mathbf{my}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{my}}\ge 1$.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}>1$.
On entry, ${\mathbf{pdc}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdc}}>0$.
On entry, ${\mathbf{pdp}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdp}}>0$.
On entry, ${\mathbf{pdt}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdt}}>0$.
On entry, ${\mathbf{pdu}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdu}}>0$.
On entry, ${\mathbf{pdw}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdw}}>0$.
On entry, ${\mathbf{pdx}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdx}}>0$.
On entry, ${\mathbf{pdxres}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdxres}}>0$.
On entry, ${\mathbf{pdy}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdy}}>0$.
On entry, ${\mathbf{pdycv}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdycv}}>0$.
On entry, ${\mathbf{pdyres}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdyres}}>0$.
NE_INT_2
On entry, ${\mathbf{ip}}=〈\mathit{\text{value}}〉$ and ${\mathbf{mx}}=〈\mathit{\text{value}}〉$.
Constraint: $1<{\mathbf{ip}}\le {\mathbf{mx}}$.
On entry, ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$ and ${\mathbf{ip}}=〈\mathit{\text{value}}〉$.
Constraint: $1\le {\mathbf{maxfac}}\le {\mathbf{ip}}$.
On entry, ${\mathbf{pdc}}=〈\mathit{\text{value}}〉$ and ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdc}}\ge {\mathbf{maxfac}}$.
On entry, ${\mathbf{pdc}}=〈\mathit{\text{value}}〉$ and ${\mathbf{my}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdc}}\ge {\mathbf{my}}$.
On entry, ${\mathbf{pdp}}=〈\mathit{\text{value}}〉$ and ${\mathbf{ip}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdp}}\ge {\mathbf{ip}}$.
On entry, ${\mathbf{pdp}}=〈\mathit{\text{value}}〉$ and ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdp}}\ge {\mathbf{maxfac}}$.
On entry, ${\mathbf{pdt}}=〈\mathit{\text{value}}〉$ and ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdt}}\ge {\mathbf{maxfac}}$.
On entry, ${\mathbf{pdt}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdt}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{pdu}}=〈\mathit{\text{value}}〉$ and ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdu}}\ge {\mathbf{maxfac}}$.
On entry, ${\mathbf{pdu}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdu}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{pdw}}=〈\mathit{\text{value}}〉$ and ${\mathbf{ip}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdw}}\ge {\mathbf{ip}}$.
On entry, ${\mathbf{pdw}}=〈\mathit{\text{value}}〉$ and ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdw}}\ge {\mathbf{maxfac}}$.
On entry, ${\mathbf{pdx}}=〈\mathit{\text{value}}〉$ and ${\mathbf{mx}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdx}}\ge {\mathbf{mx}}$.
On entry, ${\mathbf{pdx}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdx}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{pdxres}}=〈\mathit{\text{value}}〉$ and ${\mathbf{ip}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdxres}}\ge {\mathbf{ip}}$.
On entry, ${\mathbf{pdxres}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdxres}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{pdy}}=〈\mathit{\text{value}}〉$ and ${\mathbf{my}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdy}}\ge {\mathbf{my}}$.
On entry, ${\mathbf{pdy}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdy}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{pdycv}}=〈\mathit{\text{value}}〉$ and ${\mathbf{maxfac}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdycv}}\ge {\mathbf{maxfac}}$.
On entry, ${\mathbf{pdycv}}=〈\mathit{\text{value}}〉$ and ${\mathbf{my}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdycv}}\ge {\mathbf{my}}$.
On entry, ${\mathbf{pdyres}}=〈\mathit{\text{value}}〉$ and ${\mathbf{my}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdyres}}\ge {\mathbf{my}}$.
On entry, ${\mathbf{pdyres}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdyres}}\ge {\mathbf{n}}$.
NE_INT_ARG_CONS
On entry, ip is not equal to the sum of isx elements: ${\mathbf{ip}}=〈\mathit{\text{value}}〉$, $\mathrm{sum}\left({\mathbf{isx}}\right)=〈\mathit{\text{value}}〉$.
NE_INT_ARRAY_VAL_1_OR_2
On entry, element $〈\mathit{\text{value}}〉$ of isx is invalid.
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.

## 7  Accuracy

The computed singular value decomposition is nearly the exact singular value decomposition for a nearby matrix $\left(A+E\right)$, where
 $E2 = Oε A2 ,$
and $\epsilon$ is the machine precision.

nag_pls_orth_scores_svd (g02lac) allocates internally $2mr+A+\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(3\left(A+B\right),5A\right)+r$ elements of double storage, where $A=\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(m,r\right)$ and $B=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(m,r\right)$.

## 9  Example

This example reads in data from an experiment to measure the biological activity in a chemical compound, and a PLS model is estimated.

### 9.1  Program Text

Program Text (g02lace.c)

### 9.2  Program Data

Program Data (g02lace.d)

### 9.3  Program Results

Program Results (g02lace.r)