NAG Library Routine Document
G02DFF deletes an independent variable from a general linear regression model.
||IP, LDQ, INDX, IFAIL
||Q(LDQ,IP+1), RSS, WK(2*IP)
When selecting a linear regression model it is sometimes useful to drop independent variables from the model and to examine the resulting sub-model. G02DFF updates the
decomposition used in the computation of the linear regression model. The
decomposition may come from G02DAF
, or a previous call to G02DFF.
For the general linear regression model with
independent variables fitted G02DAF
decomposition of the (weighted) independent variables and form an upper triangular matrix
and a vector
. To remove an independent variable
have to be updated. The column of
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
. Note only the first
The method used means that while the updated values of
are computed an updated value of
decomposition is not available so a call to G02DEF
cannot be made after a call to G02DFF.
can be used to calculate the parameter estimates,
, from the information provided by G02DFF.
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Hammarling S (1985) The singular value decomposition in multivariate statistics SIGNUM Newsl. 20(3) 2–25
- 1: IP – INTEGERInput
On entry: , the number of independent variables already in the model.
- 2: Q(LDQ,) – REAL (KIND=nag_wp) arrayInput/Output
: the results of the
decomposition as returned by routines G02DAF
, or previous calls to G02DFF.
On exit: the updated decomposition.
- 3: LDQ – INTEGERInput
: the first dimension of the array Q
as declared in the (sub)program from which G02DFF is called.
- 4: INDX – INTEGERInput
On entry: indicates which independent variable is to be deleted from the model.
On entry: the residual sum of squares for the full regression.
: the residual sum of squares with the (INDX
)th variable removed. Note that the residual sum of squares will only be valid if the regression is of full rank, otherwise the residual sum of squares should be obtained using G02DDF
- 6: WK() – REAL (KIND=nag_wp) arrayWorkspace
- 7: IFAIL – INTEGERInput/Output
must be set to
. If you are unfamiliar with this parameter you should refer to Section 3.3
in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
. When the value is used it is essential to test the value of IFAIL on exit.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Errors or warnings detected by the routine:
|On entry,||a diagonal element of is zero.|
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 G02DAF
A dataset consisting of
observations on four independent variables and one dependent variable is read in. The full model, including a mean term, is fitted using G02DAF
. The value of INDX
is read in and that variable dropped from the regression. The parameter estimates are calculated by G02DDF
and printed. This process is repeated until INDX
9.1 Program Text
Program Text (g02dffe.f90)
9.2 Program Data
Program Data (g02dffe.d)
9.3 Program Results
Program Results (g02dffe.r)