NAG CL Interface
e04ycc (lsq_uncon_covariance)
1
Purpose
e04ycc 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.
e04ycc may be used following either of the NAG Library nonlinear least squares functions
e04fcc,
e04gbc.
2
Specification
The function may be called by the names: e04ycc, nag_opt_lsq_uncon_covariance or nag_opt_lsq_covariance.
3
Description
e04ycc is intended for use when the nonlinear least squares function,
, represents the goodness-of-fit of a nonlinear model to observed data. It assumes that the Hessian of
, at the solution, can be adequately approximated by
, where
is the Jacobian of
at the solution. The estimated variance-covariance matrix
is then given by
where
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 the matrix
.
When
is singular then
is taken to be
where
is the pseudo-inverse of
, and
but in this case the argument
fail is returned with
as a warning to you that
has linear dependencies in its columns. The assumed rank of
can be obtained from
.
The function can be used to find either the diagonal elements of , or the elements of the th column of , or the whole of .
e04ycc must be preceded by one of the nonlinear least squares functions mentioned in
Section 1, and requires the arguments
fsumsq and
options to be supplied by those functions.
fsumsq is the residual sum of squares
while the structure
options contains the members
and
which give the singular values and right singular vectors respectively in the singular value decomposition of
.
4
References
Bard Y (1974) Nonlinear Parameter Estimation Academic Press
Wolberg J R (1967) Prediction Analysis Van Nostrand
5
Arguments
-
1:
– Integer
Input
-
On entry: indicates 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.
Constraint:
.
-
2:
– Integer
Input
-
On entry: the number of observations (residuals ).
Constraint:
.
-
3:
– Integer
Input
-
On entry: the number of variables .
Constraint:
.
-
4:
– double
Input
-
On entry: the sum of squares of the residuals, , at the solution , as returned by the nonlinear least squares function.
Constraint:
.
-
5:
– double
Output
-
On exit: with
,
cj returns the
diagonal elements of
. With
,
cj returns the
elements of the
th column of
. When
,
cj is not referenced.
-
6:
– Nag_E04_Opt *
Input/Output
-
On entry/exit: the structure used in the call to the nonlinear least squares function. The following members are relevant to
e04ycc, their values should not be altered between the call to the least squares function and the call to
e04ycc.
- s – doubleInput
-
On entry: the pointer to the singular values of the Jacobian as returned by the nonlinear least squares function.
- v – doubleInput/Output
-
On entry: the pointer to the by right-hand orthogonal matrix (the right singular vectors) of as returned by the nonlinear least squares function.
On exit: when
then
is unchanged.
When then the leading by part of is overwritten by the by matrix . Matrix element is held in for and .
- tdv – IntegerInput
-
On entry: the trailing dimension used by .
-
7:
– NagError *
Input/Output
-
The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
6
Error Indicators and Warnings
- NE_2_INT_ARG_GT
-
On entry, while . These arguments must satisfy .
- NE_2_INT_ARG_LT
-
On entry, while . These arguments must satisfy .
- NE_INT_ARG_LT
-
On entry,
job must not be less than
:
.
On entry,
n must not be less than
:
.
- NE_REAL_ARG_LT
-
On entry,
fsumsq must not be less than 0.0:
.
- NE_SINGULAR_VALUES
-
The singular values are all zero, so that at the solution the Jacobian matrix has rank 0.
- NW_LIN_DEPEND
-
At the solution the Jacobian matrix contains linear, or near linear, dependencies amongst its columns. assumed to have rank .
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 (see
X02AJC). If you expect near linear dependencies at the solution and are happy with this tolerance in determining rank you should not call
e04ycc with the null pointer
NAGERR_DEFAULT as the argument
fail but should specifically declare and initialize a NagError structure for the argument
fail.
- Overflow
-
If overflow occurs then either an element of is very large, or the singular values or singular vectors have been incorrectly supplied.
7
Accuracy
The computed elements of will be the exact covariances corresponding to a closely neighbouring Jacobian matrix .
8
Parallelism and Performance
e04ycc is not threaded in any implementation.
When the time taken by the function is approximately proportional to . When the time taken by the function is approximately proportional to .
10
Example
This example estimates the variance-covariance matrix
for the least squares estimates of
,
and
in the model
using the 15 sets of data given in the following table:
The program uses (0.5,1.0,1.5) as the initial guess at the position of the minimum and computes the least squares solution using
e04fcc. Note that the structure
options is initialized by
e04xxc before calling
e04fcc. See the function documents for
e04fcc,
e04xxc and
e04xzc for further information.
10.1
Program Text
10.2
Program Data
10.3
Program Results