g02df deletes an independent variable from a general linear regression model.

# Syntax

C# |
---|

public static void g02df( int ip, double[,] q, int indx, ref double rss, out int ifail ) |

Visual Basic |
---|

Public Shared Sub g02df ( _ ip As Integer, _ q As Double(,), _ indx As Integer, _ ByRef rss As Double, _ <OutAttribute> ByRef ifail As Integer _ ) |

Visual C++ |
---|

public: static void g02df( int ip, array<double,2>^ q, int indx, double% rss, [OutAttribute] int% ifail ) |

F# |
---|

static member g02df : ip : int * q : float[,] * indx : int * rss : float byref * ifail : int byref -> unit |

#### Parameters

- ip
- Type: System..::..Int32
*On entry*: $p$, the number of independent variables already in the model.*Constraint*: ${\mathbf{ip}}\ge 1$.

- q
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, ${\mathbf{ip}}+1$]
**Note:**dim1 must satisfy the constraint: $\mathrm{dim1}\ge {\mathbf{ip}}$*On entry*: the results of the $QR$ decomposition as returned by methods**g02da****g02dc****g02de**(G02EEF not in this release), or previous calls to g02df.*On exit*: the updated $QR$ decomposition.

- indx
- Type: System..::..Int32
*On entry*: indicates which independent variable is to be deleted from the model.*Constraint*: $1\le {\mathbf{indx}}\le {\mathbf{ip}}$.

- rss
- Type: System..::..Double%
*On entry*: the residual sum of squares for the full regression.*Constraint*: ${\mathbf{rss}}\ge 0.0$.

- 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

When selecting a linear regression model it is sometimes useful to drop independent variables from the model and to examine the resulting sub-model. g02df updates the $QR$ decomposition used in the computation of the linear regression model. The $QR$ decomposition may come from g02da or g02de, or a previous call to g02df.

For the general linear regression model with $p$ independent variables fitted g02da or g02de compute a $QR$ decomposition of the (weighted) independent variables and form an upper triangular matrix $R$ and a vector $c$. To remove an independent variable $R$ and $c$ have to be updated. The column of $R$ corresponding to the variable to be dropped is removed and the matrix is then restored to upper triangular form by applying a series of Givens rotations. The rotations are then applied to $c$. Note only the first $p$ elements of $c$ are affected.

# References

Golub G H and Van Loan C F (1996)

*Matrix Computations*(3rd Edition) Johns Hopkins University Press, BaltimoreHammarling S (1985) The singular value decomposition in multivariate statistics

*SIGNUM Newsl.***20(3)**2–25# Error Indicators and Warnings

Errors or warnings detected by the method:

Some error messages may refer to parameters that are dropped from this interface
(LDQ) 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{indx}}<1$, or ${\mathbf{indx}}>{\mathbf{ip}}$, or ${\mathbf{rss}}<0.0$.

- ${\mathbf{ifail}}=2$
On entry, a diagonal element of $R$ is zero.

- ${\mathbf{ifail}}=-9000$
- An error occured, see message report.
- ${\mathbf{ifail}}=-6000$
- Invalid Parameters $\u2329\mathit{\text{value}}\u232a$
- ${\mathbf{ifail}}=-4000$
- Invalid dimension for array $\u2329\mathit{\text{value}}\u232a$
- ${\mathbf{ifail}}=-8000$
- Negative dimension for array $\u2329\mathit{\text{value}}\u232a$
- ${\mathbf{ifail}}=-6000$
- Invalid Parameters $\u2329\mathit{\text{value}}\u232a$

# Accuracy

There will inevitably be some loss in accuracy in fitting a model by dropping terms from a more complex model rather than fitting it afresh using g02da.

# Parallelism and Performance

None.

# Further Comments

None.