g02dcf adds or deletes an observation from a general regression model fitted by
g02daf.
g02daf 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.
g02dcf takes the results from
g02daf and makes the required changes to the vector
and the upper triangular matrix
produced by
g02daf. The regression coefficients, standard errors and the variance-covariance matrix of the regression coefficients can be obtained from
g02ddf after all required changes to the dataset have been made.
g02daf performs a
decomposition on the (weighted)
matrix of independent variables. To add a new observation to a model with
parameters, 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.
Note: only
and the upper part of
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:
– Character(1)
Input
-
On entry: indicates if an observation is to be added or deleted.
- The observation is added.
- The observation is deleted.
Constraint:
or .
-
2:
– Character(1)
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 g02daf.
- A model with no mean term or intercept will have been fitted by g02daf.
Constraint:
or .
-
3:
– Character(1)
Input
-
On entry: indicates if a weight is to be used.
- The new observation is unweighted.
- The new observation is to be weighted and the weight must be supplied in wt.
Constraint:
or .
-
4:
– Integer
Input
-
On entry: , the total number of independent variables in the dataset.
Constraint:
.
-
5:
– Integer array
Input
-
On entry: if
is greater than , the value contained in is to be included as a value of , for .
Constraint:
if
, exactly
elements of
isx must be
and if
, exactly
ip elements of
isx must be
.
-
6:
– Real (Kind=nag_wp) array
Input/Output
-
On entry: must be array
q as output by
g02daf,
g02def,
g02dff or
g02eef, or a previous call to
g02dcf.
On exit: the first
ip elements of the first column of
q will contain
the upper triangular part of columns
to
will contain
the remainder is unchanged.
-
7:
– Integer
Input
-
On entry: the first dimension of the array
q as declared in the (sub)program from which
g02dcf is called.
Constraint:
.
-
8:
– Integer
Input
-
On entry: the number of linear terms in general linear regression model (including mean if there is one).
Constraint:
.
-
9:
– Real (Kind=nag_wp) array
Input
-
Note: the dimension of the array
x
must be at least
.
On entry: the
ip values for the dependent variables of the new observation,
. The positions will depend on the value of
ix.
-
10:
– Integer
Input
-
On entry: the increment for elements of
x. Two situations are common:
- The values of are to be chosen from consecutive locations in x, i.e., .
- The values of are to be chosen from a row of a two-dimensional array with first dimension ldx, i.e., .
Constraint:
.
-
11:
– Real (Kind=nag_wp)
Input
-
On entry: the value of the dependent variable for the new observation, .
-
12:
– Real (Kind=nag_wp)
Input
-
On entry: if
,
wt must contain the weight to be used with the new observation.
If , the observation is not included in the model.
If
,
wt is not referenced.
Constraint:
if , .
-
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.
-
14:
– Real (Kind=nag_wp) array
Workspace
-
-
15:
– Integer
Input/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).
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
-
On entry, elements of instead of .
On entry, elements of instead of (for mean) .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: or .
On entry, .
Constraint: .
On entry, .
Constraint: or .
On entry, .
Constraint: or .
Background information to multithreading can be found in the
Multithreading documentation.
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.
Care should be taken with the use of
g02dcf.
-
(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 g02daf.
-
(c)Adding or deleting observations can alter the rank of the model. Such changes will only be detected when a call to g02ddf has been made. g02ddf should also be used to compute the new residual sum of squares when the model is not of full rank.
g02dcf may also be used after
g02def,
g02dff and
g02eef.
A dataset consisting of
observations with four independent variables is read in and a general linear regression model fitted by
g02daf and parameter estimates printed. The last observation is then dropped and the parameter estimates recalculated, using
g02ddf, and printed. Finally a new observation is added and new parameter estimates computed and printed.