The routine may be called by the names g02ddf or nagf_correg_linregm_update.
A general linear regression model fitted by g02daf may be adjusted by adding or deleting an observation using g02dcf, adding a new independent variable using g02def or deleting an existing independent variable using g02dff. Alternatively a model may be constructed by a forward selection procedure using g02eef. These routines compute the vector and the upper triangular matrix . g02ddf takes these basic results and computes the regression coefficients, , their standard errors and their variance-covariance matrix.
If is of full rank, then is the solution to
where is the first elements of .
If is not of full rank a solution is obtained by means of a singular value decomposition (SVD) of ,
where is a diagonal matrix with nonzero diagonal elements, being the rank of , and and are orthogonal matrices. This gives the solution
being the first columns of , i.e., , and being the first columns of .
Details of the SVD are made available in the form of the matrix :
This will be only one of the possible solutions. Other estimates may be obtained by applying constraints to the parameters. These solutions can be obtained by calling g02dkf after calling g02ddf. Only certain linear combinations of the parameters will have unique estimates; these are known as estimable functions. These can be estimated using g02dnf.
The residual sum of squares required to calculate the standard errors and the variance-covariance matrix can either be input or can be calculated if additional information on for the whole sample is provided.
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
Searle S R (1971) Linear Models Wiley
1: – IntegerInput
On entry: the number of observations.
2: – IntegerInput
On entry: , the number of terms in the regression model.
On entry: the first dimension of the array q as declared in the (sub)program from which g02ddf is called.
if , ;
5: – Real (Kind=nag_wp)Input/Output
On entry: either the residual sum of squares or a value less than or equal to to indicate that the residual sum of squares is to be calculated by the routine.
On exit: if on entry, then on exit rss will contain the residual sum of squares as calculated by g02ddf.
If rss was positive on entry, it will be unchanged.
6: – IntegerOutput
On exit: the degrees of freedom associated with the residual sum of squares.
7: – Real (Kind=nag_wp) arrayOutput
On exit: the estimates of the parameters, .
8: – Real (Kind=nag_wp) arrayOutput
On exit: the standard errors of the parameters given in b.
9: – Real (Kind=nag_wp) arrayOutput
On exit: the upper triangular part of the variance-covariance matrix of the parameter estimates given in b. They are stored packed by column, i.e., the covariance between the parameter estimate given in and the parameter estimate given in , , is stored in .
10: – LogicalOutput
On exit: if a singular value decomposition has been performed, , otherwise .
11: – IntegerOutput
On exit: the rank of the independent variables.
If , .
If , irank is an estimate of the rank of the independent variables.
irank is calculated as the number of singular values greater than (largest singular value). It is possible for the SVD to be carried out but irank to be returned as ip.
If , the first ip elements of p are unchanged, the next ip values contain the singular values. The following values contain the matrix stored by columns.
13: – Real (Kind=nag_wp)Input
On entry: the value of tol is used to decide if the independent variables are of full rank and, if not, what is the rank of the independent variables. The smaller the value of tol the stricter the criterion for selecting the singular value decomposition. If , the singular value decomposition will never be used, this may cause run time errors or inaccuracies if the independent variables are not of full rank.
14: – Real (Kind=nag_wp) arrayWorkspace
15: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
On entry, and .
Constraint: if , .
On entry, and .
On entry, .
On entry, .
The degrees of freedom for error are less than or equal to . In this case the estimates of are returned but not the standard errors or covariances.
SVD solution failed to converge.
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
The accuracy of the results will depend on the accuracy of the input matrix, which may lose accuracy if a large number of observations or variables have been dropped.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
g02ddf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g02ddf 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 routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
A dataset consisting of observations and four independent variables is input and a regression model fitted by calls to g02def. The parameters are then calculated by g02ddf and the results printed.