The function may be called by the names: g02dcc, nag_correg_linregm_obs_edit or nag_regsn_mult_linear_addrem_obs.
g02dac fits a general linear regression model to a dataset. You may wish to change the model by either adding or deleting an observation from the dataset. g02dcc takes the results from g02dac and makes the required changes to the vector and the upper triangular matrix produced by g02dac. The regression coefficients, standard errors and the variance-covariance matrix of the regression coefficients can be obtained from g02ddc after all required changes to the dataset have been made.
g02dac performs a decomposition on the (weighted) matrix of independent variables. To add a new observation to a model with arguments the upper triangular matrix and vector , the first elements of , are augmented by the new observation on independent variables in and dependent variable . Givens rotations are then used to restore the upper triangular form.
To delete an observation Givens rotations are applied to give:
Note: only the and upper part of the are updated, the remainder of the matrix is unchanged.
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: – Nag_UpdateObservInput
On entry: indicates if an observation is to be added or deleted.
The observation is added.
The observation is deleted.
2: – Nag_IncludeMeanInput
On entry: indicates if a mean has been used in the model.
A mean term or intercept will have been included in the model by g02dac.
A model with no mean term or intercept will have been fitted by g02dac.
3: – IntegerInput
On entry: the total number of independent variables in the dataset.
4: – const IntegerInput
On entry: if is greater than , then the value contained in is to be included as a value of , an observation on an independent variable, for .
if , then exactly elements of sx must be and if , then exactly ip elements of sx must be .
On exit: the first ip elements of the first column of q will contain , the upper triangular part of columns 2 to will contain , the remainder is unchanged.
6: – IntegerInput
On entry: the stride separating matrix column elements in the array q.
7: – IntegerInput
On entry: the number of linear terms in general linear regression model (including mean if there is one).
8: – const doubleInput
On entry: the ip values for the dependent variables of the observation to be added or deleted, . The positions of the values x extracted depends on ix and tdx.
9: – IntegerInput
On entry: the number of rows of the notional two-dimensional array x.
10: – IntegerInput
On entry: the stride separating matrix column elements in the array x.
11: – IntegerInput
On entry: the row of the notional two-dimensional array x that contains the values for the dependent variables of the observation to be added or deleted.
12: – doubleInput
On entry: the value of the dependent variable for the observation to be added or deleted, .
13: – const doubleInput
On entry: if the new observation is to be weighted, then wt must contain the weight to be used with the new observation. If , then the observation is not included in the model. If the new observation is to be unweighted, then wt must be supplied as NULL.
if the new observation is to be weighted .
14: – double *Input/Output
On entry: the value of the residual sums of squares for the original set of observations.
On exit: the updated values of the residual sums of squares.
Note: this will only be valid if the model is of full rank.
15: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
On entry, for , number of nonzero values of sx must be equal to : number of nonzero values of , .
On entry, for , number of nonzero values of sx must be equal to ip: number of nonzero values of , .
The matrix could not be updated: to, either, delete nonexistent observation, or, add an observation to matrix with zero diagonal element.
On entry, .
The rss could not be updated because the input rss was less than the calculated decrease in rss when the new observation was deleted.
Higher accuracy is achieved by updating the matrix rather than the traditional methods of updating X'X.
8Parallelism and Performance
g02dcc is not threaded in any implementation.
Care should be taken with the use of this function.
(a)It is possible to delete observations which were not included in the original model.
(b)If several additions/deletions have been performed you are advised to recompute the regression using g02dac.
(c)Adding or deleting observations can alter the rank of the model. Such changes will only be detected when a call to g02ddc has been made. g02ddc should also be used to compute the new residual sum of squares when the model is not of full rank.
A dataset consisting of 12 observations with four independent variables is read in and a general linear regression model fitted by g02dac and parameter estimates printed. The last observation is then dropped and the parameter estimates recalculated, using g02ddc, and printed.