nag_opt_lsq_covariance (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.
nag_opt_lsq_covariance (e04ycc) may be used following either of the NAG C Library nonlinear least squares functions
nag_opt_lsq_no_deriv (e04fcc),
nag_opt_lsq_deriv (e04gbc).
nag_opt_lsq_covariance (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
.
nag_opt_lsq_covariance (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
.
Not applicable.
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
nag_opt_lsq_no_deriv (e04fcc). Note that the structure
options is initialized by
nag_opt_init (e04xxc) before calling
nag_opt_lsq_no_deriv (e04fcc). See the function documents for
nag_opt_lsq_no_deriv (e04fcc),
nag_opt_init (e04xxc) and
nag_opt_free (e04xzc) for further information.