NAG Library Routine Document
E04YCF returns estimates of elements of the variance-covariance matrix of the estimated regression coefficients for a nonlinear least squares problem. The estimates are derived from the Jacobian of the function at the solution.
This routine may be used following any one of the nonlinear least squares routines E04FCF
||JOB, M, N, LDV, IFAIL
||FSUMSQ, S(N), V(LDV,N), CJ(N), WORK(N)
E04YCF is intended for use when the nonlinear least squares function,
, represents the goodness-of-fit of a nonlinear model to observed data. The routine assumes that the Hessian of
, at the solution, can be adequately approximated by
is the Jacobian of
at the solution. The estimated variance-covariance matrix
is then given by
is the estimated variance of the residual at the solution,
, given by
being the number of observations and
the number of variables.
The diagonal elements of
are estimates of the variances of the estimated regression coefficients. See the E04 Chapter Introduction
, Bard (1974)
and Wolberg (1967)
for further information on the use of
is singular then
is taken to be
is the pseudo-inverse of
but in this case the parameter IFAIL
is returned as nonzero as a warning to you that
has linear dependencies in its columns. The assumed rank of
can be obtained from IFAIL
The routine can be used to find either the diagonal elements of , or the elements of the th column of , or the whole of .
E04YCF must be preceded by one of the nonlinear least squares routines mentioned in Section 1
, and requires the parameters FSUMSQ
to be supplied by those routines (e.g., see E04FCF
is the residual sum of squares
contain the singular values and right singular vectors respectively in the singular value decomposition of
are returned directly by the comprehensive routines E04FCF
, but are returned as part of the workspace parameter W
(from one of the easy-to-use routines). In the case of E04FYF
and in the cases of the remaining easy-to-use routines, S
The parameter V
starts immediately following the elements of S
, so that V
For all the easy-to-use routines the parameter LDV
must be supplied as N
. Thus a call to E04YCF following E04FYF
can be illustrated as
CALL E04FYF (M, N, LFUN1, X, FSUMSQ, W, LW, IUSER, RUSER, IFAIL)
NS = 6*N _ 2*M + M*N + 1 MAX((1,(N*(N-1))/2)
NV = NS + N;
CALL E04YCF (JOB, M, N, FSUMSQ, W(NS), W(NV), N, CJ, WORK, IFAIL)
where the parameters M
must not be altered between the calls to E04FYF
and E04YCF. The above illustration also holds for a call to E04YCF following a call to one of E04GYF
, except that
must be computed as
Bard Y (1974) Nonlinear Parameter Estimation Academic Press
Wolberg J R (1967) Prediction Analysis Van Nostrand
- 1: JOB – INTEGERInput
: which elements of
are returned as follows:
- The by symmetric matrix is returned.
- The diagonal elements of are returned.
- The elements of column JOB of are returned.
- 2: M – INTEGERInput
On entry: the number of observations (residuals ).
- 3: N – INTEGERInput
On entry: the number of variables .
- 4: FSUMSQ – REAL (KIND=nag_wp)Input
On entry: the sum of squares of the residuals, , at the solution , as returned by the nonlinear least squares routine.
- 5: S(N) – REAL (KIND=nag_wp) arrayInput
singular values of the Jacobian as returned by the nonlinear least squares routine. See Section 3
for information on supplying S
following one of the easy-to-use routines.
- 6: V(LDV,N) – REAL (KIND=nag_wp) arrayInput/Output
right-hand orthogonal matrix (the right singular vectors) of
as returned by the nonlinear least squares routine. See Section 3
for information on supplying V
following one of the easy-to-use routines.
, the leading
part of V
is overwritten by the
. When E04YCF is called with
following an easy-to-use routine this means that
is returned, column by column, in the
elements of W
. (See Section 3
for the definition of
- 7: LDV – INTEGERInput
: the first dimension of the array V
as declared in the (sub)program from which E04YCF is called. When V
is passed in the workspace parameter W
(following one of the easy-to-use least square routines), LDV
must be the value N
if , .
- 8: CJ(N) – REAL (KIND=nag_wp) arrayOutput
diagonal elements of
elements of the
th column of
is not referenced.
- 9: WORK(N) – REAL (KIND=nag_wp) arrayWorkspace
is used as internal workspace.
is not referenced.
- 10: 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, because for this routine the values of the output parameters may be useful even if
on exit, 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
Note: E04YCF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
The singular values are all zero, so that at the solution the Jacobian matrix has rank .
At the solution the Jacobian matrix contains linear, or near linear, dependencies amongst its columns. In this case the required elements of
have still been computed based upon
having an assumed rank given by
. The rank is computed by regarding singular values
that are not larger than
as zero, where
is the machine precision
). If you expect near linear dependencies at the solution and are happy with this tolerance in determining rank you should call E04YCF with
in order to prevent termination (see the description of IFAIL
). It is then essential to test the value of IFAIL
on exit from E04YCF.
If overflow occurs then either an element of is very large, or the singular values or singular vectors have been incorrectly supplied.
The computed elements of will be the exact covariances corresponding to a closely neighbouring Jacobian matrix .
When the time taken by E04YCF is approximately proportional to . When the time taken by the routine is approximately proportional to .
This example estimates the variance-covariance matrix
for the least squares estimates of
in the model
sets of data given in the following table:
The program uses
as the initial guess at the position of the minimum and computes the least squares solution using E04FYF
. See the routine document E04FYF
for further information.
9.1 Program Text
Program Text (e04ycfe.f90)
9.2 Program Data
Program Data (e04ycfe.d)
9.3 Program Results
Program Results (e04ycfe.r)