naginterfaces.library.opt.lsq_​uncon_​covariance

naginterfaces.library.opt.lsq_uncon_covariance(job, m, fsumsq, s, v)[source]

lsq_uncon_covariance 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 function may be used following any one of the nonlinear least squares functions lsq_uncon_mod_func_comp(), lsq_uncon_quasi_deriv_comp(), lsq_uncon_mod_deriv_comp() or lsq_uncon_mod_deriv2_comp().

For full information please refer to the NAG Library document for e04yc

https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/e04/e04ycf.html

Parameters
jobint

Which elements of are returned as follows:

The symmetric matrix is returned.

The diagonal elements of are returned.

The elements of column of are returned.

mint

The number of observations (residuals ).

fsumsqfloat

The sum of squares of the residuals, , at the solution , as returned by the nonlinear least squares function.

sfloat, array-like, shape

The singular values of the Jacobian as returned by the nonlinear least squares function. See Notes for information on supplying following one of the easy-to-use functions.

vfloat, array-like, shape

The right-hand orthogonal matrix (the right singular vectors) of as returned by the nonlinear least squares function. See Notes for information on supplying following one of the easy-to-use functions.

Returns
vfloat, ndarray, shape

If , is unchanged.

If , the leading part of is overwritten by the matrix .

When lsq_uncon_covariance is called with following an easy-to-use function this means that is returned, column by column, in the elements of given by . (See Notes for the definition of .)

cjfloat, ndarray, shape

If , returns the diagonal elements of .

If , returns the elements of the th column of .

If , is not referenced.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, , and .

Constaint: if , .

Warns
NagAlgorithmicWarning
(errno )

The singular values are all zero, so that at the solution the Jacobian matrix has rank .

(errno )

At the solution the Jacobian matrix contains linear, or near linear, dependencies amongst its columns. The required elements of have still been computed based upon having an assumed rank . The rank is computed by regarding as zero singular values that are not larger than , where is the machine precision (see machine.precision).

Notes

In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.

lsq_uncon_covariance is intended for use when the nonlinear least squares function, , represents the goodness-of-fit of a nonlinear model to observed data. The function 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 Introduction, Bard (1974) and Wolberg (1967) for further information on the use of .

When is singular then is taken to be

where is the pseudo-inverse of , and

but in this case the argument is returned as nonzero 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 .

References

Bard, Y, 1974, Nonlinear Parameter Estimation, Academic Press

Wolberg, J R, 1967, Prediction Analysis, Van Nostrand