|
|
◆ WDggglm()
| Function WDggglm |
( |
N As |
Long, |
|
|
M As |
Long, |
|
|
P As |
Long, |
|
|
A As |
Variant, |
|
|
B As |
Variant, |
|
|
D As |
Variant |
|
) |
| |
General Gauss-Markov linear model (GLM) problem
- Purpose
- WDggglm solves a general Gauss-Markov linear model (GLM) problem:
minimize || y ||_2 subject to d = A*x + B*y
x
where A is an N x M matrix, B is an N x P matrix, and d is a given N vector. It is assumed that M <= N <= M + P, and rank(A) = M and rank(A B) = N
Under these assumptions, the constrained equation is always consistent, and there is a unique solution x and a minimal 2-norm solution y, which is obtained using a generalized QR factorization of the matrices (A, B) given by In particular, if matrix B is square nonsingular, then the problem GLM is equivalent to the following weighted linear least squares problem minimize || inv(B)*(d - A*x) ||_2
x
- Returns
- max(M,P)+1 x 2
| Column 1 | Column 2 |
| Rows 1 to max(M,P) | Least squares solution vector x (Rows 1 to M) | Residual vector y (Rows 1 to P) |
| Row max(M,P)+1 | 2-norm of residual sum of squares (||y||2) | Return code |
Return code
= 0: Successful exit
= 1: The least squares solution could not be computed. The upper triangular factor R associated with A in the generalized QR factorization of the pair (A, B) is singular, so that rank(A) < M.
= 2: The least squares solution could not be computed. The bottom N-M x N-M part of the upper trapezoidal factor T associated with B in the generalized QR factorization of the pair (A, B) is singular, so that rank(A B) < N.
- Parameters
-
| [in] | N | Number of rows of the matrices A and B. (N >= 1) |
| [in] | M | Number of columns of the matrix A. (1 <= M <= N) |
| [in] | P | Number of columns of the matrix B. (N - M <= P) |
| [in] | A | (N x M) N x M coefficient matrix A of the GLM equation. |
| [in] | B | (N x P) N x P coefficient matrix B of the GLM equation. |
| [in] | D | (N) Left hand side vector d of the GLM equation. |
- Reference
- LAPACK
- Example
- Solve a general Gauss-Markov linear model (GLM) problem, i.e. find x which minimizes || y ||_2 subject to d = A*x + B*y, where
( -1.06 0.48 -0.04 )
A = ( -1.19 0.73 -0.24 )
( 1.97 -0.89 0.56 )
( 0.68 -0.53 0.08 )
( 1 0 0 0 )
B = ( 0 1 0 0 )
( 0 0 1 0 )
( 0 0 0 1 )
( 0.3884 )
d = ( 0.1120 )
( -0.3644 )
( -0.0002 )
|