XLPack 7.0
XLPack Numerical Library (Excel VBA) Reference Manual
Loading...
Searching...
No Matches

◆ Dgecovs()

Sub Dgecovs ( Job As  Long,
N As  Long,
A() As  Double,
S() As  Double,
Ci() As  Double,
Info As  Long 
)

Unscaled covariance matrix of linear least squares problem solved by Dgelss

Purpose
This routine computes the unscaled covariance matrix of linear least squares problem solved by Dgelss.

The following least squares problem with m x n matrix A can be solved by Dgelss.
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.
Parameters
[in]Job= -1: The lower triangle of C is computed. (Note that the lower trangle is computed different from Dgecov and Dgecovy)
= 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]A()Array A(LA1 - 1, LA2 - 1) (LA1 >= N, LA2 >= N)
[in] The right singular vectors returned by Dgelss. [out] Job = -1: A() is overwritten by the lower triangule of C. The strictly upper triangle part of A() is destroyed.
[in]S()Array S(LS - 1) (LS >= N)
Singular values computed by Dgelss.
[out]Ci()Array Ci(LCi - 1) (LCi >= 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.
[out]Info= 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 S() is invalid.
= -5: The argument Ci() is invalid.
Example Program
See example of Dgelss.