g02dcc adds or deletes an observation from a general regression model fitted by
g02dac.
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.
Hammarling S (1985) The singular value decomposition in multivariate statistics SIGNUM Newsl. 20(3) 2–25
-
1:
– Nag_UpdateObserv
Input
-
On entry: indicates if an observation is to be added or deleted.
- The observation is added.
- The observation is deleted.
Constraint:
or .
-
2:
– Nag_IncludeMean
Input
-
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.
Constraint:
or .
-
3:
– Integer
Input
-
On entry: the total number of independent variables in the dataset.
Constraint:
.
-
4:
– const Integer
Input
-
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 .
Constraint:
if
, then exactly
elements of
sx must be
and if
, then exactly
ip elements of
sx must be
.
-
5:
– double
Input/Output
-
Note: the th element of the matrix is stored in .
On entry:
q must be array
q as output by
g02dac,
g02dec,
g02dfc, or a previous call to
g02dcc.
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:
– Integer
Input
-
On entry: the stride separating matrix column elements in the array
q.
Constraint:
.
-
7:
– Integer
Input
-
On entry: the number of linear terms in general linear regression model (including mean if there is one).
Constraint:
.
-
8:
– const double
Input
-
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:
– Integer
Input
-
On entry: the number of rows of the notional two-dimensional array
x.
Constraint:
.
-
10:
– Integer
Input
-
On entry: the stride separating matrix column elements in the array
x.
Constraint:
.
-
11:
– Integer
Input
-
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.
Constraint:
.
-
12:
– double
Input
-
On entry: the value of the dependent variable for the observation to be added or deleted, .
-
13:
– const double
Input
-
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.
Constraint:
if the new observation is to be weighted .
-
On entry: the value of the residual sums of squares for the original set of observations.
Constraint:
.
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).
- NE_2_INT_ARG_GT
-
On entry, while . These arguments must satisfy .
- NE_2_INT_ARG_LT
-
On entry, while . These arguments must satisfy .
On entry, while . These arguments must satisfy .
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
- NE_BAD_PARAM
-
On entry,
mean had an illegal value.
On entry,
update had an illegal value.
- NE_INT_ARG_LT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_IP_INCOMP_WITH_SX
-
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
,
.
- NE_MAT_NOT_UPD
-
The matrix could not be updated: to, either, delete nonexistent observation, or, add an observation to matrix with zero diagonal element.
- NE_REAL_ARG_LT
-
On entry, .
Constraint: .
On entry,
Constraint: .
-
The
rss could not be updated because the input
rss was less than the calculated decrease in
rss when the new observation was deleted.
Background information to multithreading can be found in the
Multithreading documentation.
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.