XLPack 6.1
Python API Reference Manual
Loading...
Searching...
No Matches

◆ dgecov()

def dgecov ( job  ,
,
,
ci   
)

Unscaled covariance matrix of linear least squares problem solved by dgels

Purpose
dgecov computes the unscaled covariance matrix of linear least squares problem solved by dgels.

The following least squares problem with m x n matrix A can be solved by dgels if rank(A) = n.
minimize ||A*x - b||
The n x n symmetric positive definite matrix C, the unscaled covariance matrix of the estimated parameters, is defined as below.
C = (A^T*A)^(-1), rank(A) = n
The scalar multiple (sigma^2)*C has a statiscal interpretation of being an estimate of the variance-covariance matrix for the solution vector of the least squares problem. The scalar factor sigma^2 is expressed as follows.
sigma^2 = ||A*x - b||^2 / (m - n)
where x is the least squares solution. The diagonal elements of (sigma^2)*C give the variance of each component of x.
Returns
info (int)
= 0: Successful exit
= -1: The argument job had an illegal value (job < -1 or job > n)
= -2: The argument n had an illegal value (n < 0)
= -3: The argument a is invalid.
= -4: The argument ci is invalid.
= i > 0: Other error encountered
Parameters
[in]job= -1: The upper triangle of C is computed.
= 0: The diagonal elements of C are computed.
= i > 0: i-th column of C is computed. (i <= n)
[in]nThe order of the matrix A = rank of A. (should not be rank deficient). (n >= 0) (If n = 0, returns without computation)
[in,out]aNumpy ndarray (2-dimensional, float, n x n)
[in] The QR factorized matrix returned by dgels.
[out] job = -1: a[][] is overwritten by the upper triangle of C.
  job = 0: The upper triangle of a[][] is to be destroyed.
[out]ciNumpy ndarray (1-dimensional, float, n)
job = -1: Not referenced.
job = 0: The diagonal elements of C are returned.
job = i > 0: The i-th column of C is returned.
Example Program
See example of dgels.