g02gn gives the estimate of an estimable function along with its standard error from the results from fitting a generalized linear model.

Syntax

C#
```public static void g02gn(
int ip,
int irank,
double[] b,
double[] cov,
double[,] v,
double[] f,
out bool est,
out double stat,
out double sestat,
out double z,
double tol,
out int ifail
)```
Visual Basic
```Public Shared Sub g02gn ( _
ip As Integer, _
irank As Integer, _
b As Double(), _
cov As Double(), _
v As Double(,), _
f As Double(), _
<OutAttribute> ByRef est As Boolean, _
<OutAttribute> ByRef stat As Double, _
<OutAttribute> ByRef sestat As Double, _
<OutAttribute> ByRef z As Double, _
tol As Double, _
<OutAttribute> ByRef ifail As Integer _
)```
Visual C++
```public:
static void g02gn(
int ip,
int irank,
array<double>^ b,
array<double>^ cov,
array<double,2>^ v,
array<double>^ f,
[OutAttribute] bool% est,
[OutAttribute] double% stat,
[OutAttribute] double% sestat,
[OutAttribute] double% z,
double tol,
[OutAttribute] int% ifail
)```
F#
```static member g02gn :
ip : int *
irank : int *
b : float[] *
cov : float[] *
v : float[,] *
f : float[] *
est : bool byref *
stat : float byref *
sestat : float byref *
z : float byref *
tol : float *
ifail : int byref -> unit
```

Parameters

ip
Type: System..::..Int32
On entry: $p$, the number of terms in the linear model.
Constraint: ${\mathbf{ip}}\ge 1$.
irank
Type: System..::..Int32
On entry: $k$, the rank of the dependent variables.
Constraint: $1\le {\mathbf{irank}}\le {\mathbf{ip}}$.
b
Type: array<System..::..Double>[]()[][]
An array of size [ip]
On entry: the ip values of the estimates of the parameters of the model, $\stackrel{^}{\beta }$.
cov
Type: array<System..::..Double>[]()[][]
An array of size [${\mathbf{ip}}×\left({\mathbf{ip}}+1\right)/2$]
On entry: the upper triangular part of the variance-covariance matrix of the ip parameter estimates given in b. They are stored packed by column, i.e., the covariance between the parameter estimate given in ${\mathbf{b}}\left[i-1\right]$ and the parameter estimate given in ${\mathbf{b}}\left[j-1\right]$, $j\ge i$, is stored in ${\mathbf{cov}}\left[\left(j×\left(j-1\right)/2+i\right)-1\right]$.
v
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, ${\mathbf{ip}}+7$]
Note: dim1 must satisfy the constraint: $\mathrm{dim1}\ge {\mathbf{ip}}$
On entry: as returned by g02gag02gbg02gc and g02gd.
f
Type: array<System..::..Double>[]()[][]
An array of size [ip]
On entry: $f$, the linear function to be estimated.
est
Type: System..::..Boolean%
On exit: indicates if the function was estimable.
${\mathbf{est}}=\mathrm{true}$
The function is estimable.
${\mathbf{est}}=\mathrm{false}$
The function is not estimable and stat, sestat and z are not set.
stat
Type: System..::..Double%
On exit: if ${\mathbf{est}}=\mathrm{true}$, stat contains the estimate of the function, ${f}^{\mathrm{T}}\stackrel{^}{\beta }$
sestat
Type: System..::..Double%
On exit: if ${\mathbf{est}}=\mathrm{true}$, sestat contains the standard error of the estimate of the function, $\mathrm{se}\left(F\right)$.
z
Type: System..::..Double%
On exit: if ${\mathbf{est}}=\mathrm{true}$, z contains the $z$ statistic for the test of the function being equal to zero.
tol
Type: System..::..Double
On entry: the tolerance value used in the check for estimability, $\eta$.
If ${\mathbf{tol}}\le 0.0$ then $\sqrt{\epsilon }$, where $\epsilon$ is the machine precision, is used instead.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

g02gn computes the estimates of an estimable function for a generalized linear model which is not of full rank. It is intended for use after a call to g02gag02gbg02gc or g02gd. An estimable function is a linear combination of the parameters such that it has a unique estimate. For a full rank model all linear combinations of parameters are estimable.
In the case of a model not of full rank the methods use a singular value decomposition (SVD) to find the parameter estimates, $\stackrel{^}{\beta }$, and their variance-covariance matrix. Given the upper triangular matrix $R$ obtained from the $QR$ decomposition of the independent variables the SVD gives
 $R=Q*D000PT,$
where $D$ is a $k$ by $k$ diagonal matrix with nonzero diagonal elements, $k$ being the rank of $R$, and ${Q}_{*}$ and $P$ are $p$ by $p$ orthogonal matrices. This leads to a solution:
 $β^=P1D-1Q*1Tc1,$
${P}_{1}$ being the first $k$ columns of $P$, i.e., $P=\left({P}_{1}{P}_{0}\right)$; ${Q}_{{*}_{1}}$ being the first $k$ columns of ${Q}_{*}$, and ${c}_{1}$ being the first $p$ elements of $c$.
Details of the SVD are made available in the form of the matrix ${P}^{*}$:
 $P*=D-1P1TP0T$
as described by g02gag02gbg02gc and g02gd.
A linear function of the parameters, $F={f}^{\mathrm{T}}\beta$, can be tested to see if it is estimable by computing $\zeta ={P}_{0}^{\mathrm{T}}f$. If $\zeta$ is zero, then the function is estimable, if not; the function is not estimable. In practice $\left|\zeta \right|$ is tested against some small quantity $\eta$.
Given that $F$ is estimable it can be estimated by ${f}^{\mathrm{T}}\stackrel{^}{\beta }$ and its standard error calculated from the variance-covariance matrix of $\stackrel{^}{\beta }$, ${C}_{\beta }$, as
 $seF=fTCβf.$
Also a $z$ statistic
 $z=fTβ^seF,$
can be computed. The distribution of $z$ will be approximately Normal.

References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
McCullagh P and Nelder J A (1983) Generalized Linear Models Chapman and Hall
Searle S R (1971) Linear Models Wiley

Error Indicators and Warnings

Note: g02gn may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDV) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{ip}}<1$, or ${\mathbf{irank}}<1$, or ${\mathbf{irank}}>{\mathbf{ip}}$,
${\mathbf{ifail}}=2$
 On entry, ${\mathbf{irank}}={\mathbf{ip}}$. In this case est is returned as true and all statistics are calculated.
${\mathbf{ifail}}=3$
Standard error of statistic $\text{}=0.0$; this may be due to rounding errors if the standard error is very small or due to mis-specified inputs cov and f.
${\mathbf{ifail}}=-9000$
An error occured, see message report.
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-4000$
Invalid dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-8000$
Negative dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$

Accuracy

The computations are believed to be stable.

None.

Further Comments

The value of estimable functions is independent of the solution chosen from the many possible solutions. While g02gn may be used to estimate functions of the parameters of the model as computed by g02gk, ${\beta }_{\mathrm{c}}$, these must be expressed in terms of the original parameters, $\beta$. The relation between the two sets of parameters may not be straightforward.