Fits a multivariate linear regression model given the variance-covariance matrix.
Required Arguments
COV — NIND + NDEP by NIND + NDEP matrix containing the variance-covariance matrix or sum of squares and crossproducts matrix. (Input) Only the upper triangle of COV is referenced. The first NIND rows and columns correspond to the independent variables, and the last NDEP rows and columns correspond to the dependent variables. If INTCEP = 0, COV contains raw sums of squares and crossproducts. If INTCEP = 1, COV contains sums of squares and crossproducts corrected for the mean. If weighting is desired, COV contains weighted sums of squares and crossproducts.
XYMEAN — Vector of length NIND + NDEP containing variable means. (Input, if INTCEP = 1) The first NIND elements of XYMEAN are for the independent variables in the same order in which they appear in COV. The last NDEP elements of XYMEAN are for the dependent variables in the same order in which they appear in COV. If weighting is desired, XYMEAN contains weighted means. If INTCEP = 0, XYMEAN is not referenced and can be a vector of length one.
SUMWTF — Sum of products of weights with frequencies. (Input, if INTCEP = 1) In the ordinary case when weights and frequencies are all one, SUMWTF equals the number of observations.
B — INTCEP + NIND by NDEP matrix containing a least-squares solution for the regression coefficients. (Output) Column j is for the j-th dependent variable. If INTCEP = 1, row 1 is for the intercept. Row INTCEP + i is for the i-th independent variable. Elements of the appropriate row(s) of are set to 0.0 if linear dependence of the regressors is declared.
NIND — Number of independent (explanatory) variables. (Input) Default: NIND = size (B,1) ‑INTCEP.
NDEP — Number of dependent (response) variables. (Input) Default: NDEP = size (B,2).
LDCOV — Leading dimension of COV exactly as specified in the dimension statement in the calling program. (Input) Default: LDCOV = size (COV,1).
TOL — Tolerance used in determining linear dependence. (Input) For RCOV, TOL = 100 *AMACH(4) is a common choice. See documentation for routine AMACH in Reference Material. Default: TOL = 1.e-5 for single precision and 2.d -14 for double precision.
LDB — Leading dimension of B exactly as specified in the dimension statement in the calling program. (Input) Default: LDB = size (B,1).
R — INTCEP + NIND by INTCEP + NIND upper triangular matrix containing the R matrix from a Cholesky factorization RTR of the matrix of sums of squares and crossproducts of the regressors. (Output) Elements of the appropriate row(s) of R are set to 0.0 if linear dependence of the regressors is declared.
LDR — Leading dimension of R exactly as specified in the dimension statement in the calling program. (Input) Default: LDR = size (R,1).
IRANK — Rank of R. (Output) IRANK less than INTCEP + NIND indicates that linear dependence of the regressors was declared. In this case, some rows of are set to zero.
SCPE — NDEP by NDEP matrix containing the error (residual) sums of squares and crossproducts. (Output)
LDSCPE — Leading dimension of SCPE exactly as specified in the dimension statement in the calling program. (Input) Default: LDSCPE = size (SCPE,1).
FORTRAN 90 Interface
Generic: CALLRCOV (COV, XYMEAN, SUMWTF, B[, …])
Specific: The specific interface names are S_RCOV and D_RCOV.
Routine RCOV fits a multivariate linear regression model given the variance-covariance matrix (or sum of squares and crossproducts matrix) for the independent and dependent variables. Typically, an intercept is to be in the model, and the corrected sum of squares and crossproducts matrix is input for COV. Routine CORVC in Chapter 3, “Correlation” can be invoked to compute the corrected sum of squares and crossproducts matrix. Routine RORDM in Chapter 19, “Utilities” can reorder this matrix, if required. If an intercept is not to be included in the model, a raw (uncorrected) sum of squares and crossproducts matrix must be input for COV; and SUMWTF and XYMEAN are not used in the computations. Routine MXTXF (IMSL MATH/LIBRARY) can be used to compute the raw sum of squares and crossproducts matrix.
Routine RCOV is based on a Cholesky factorization of COV. Let k (input in NIND) be the the number of independent variables, and d (input in SUMWTF) the denominator used in computing the x means (input in the first k locations of XYMEAN). The matrix R is formed by computing a Cholesky factorization of the first k rows and columns of COV. If INTCEP equals one, the k rows from this factorization are appended to the initial row
The resulting R matrix is the Cholesky factor of the XTX matrix where X contains a column of ones as its first column and the independent variable settings as its remaining k columns.
Maindonald (1984, Chapter 3) discusses the Cholesky factorization as it applies to regression computations.
The routine RCOV checks sequentially for linear dependent regressors. Linear dependence of the regressors is declared if
is less than or equal to TOL. Here, Ri⋅1,2,…,i−1 is the multiple correlation coefficient of the i-th independent variable with the first i‑ 1 independent variables. If no intercept is in the model (INTCEP = 0), the “multiple correlation” coefficient is computed without adjusting for the mean. When a dependence is declared, elements of the corresponding rows of R and B are set to zero. Maindonald (1984, Sections 3.3, 3.4, and 3.9) discusses these implementation details of the Cholesky factorization in regression problems.
Comments
1. Informational error
Type
Code
Description
3
1
COV is not a variance-covariance matrix within the tolerance defined by TOL.
Example
This example uses a data set from Draper and Smith (1981, pages 629 ‑ 630). This data set is put into the matrix X by routine GDATA (Chapter 19, “Utilities”). The first four columns are for the independent variables, and the last column is for the dependent variable. Routine CORVC in Chapter 3, “Correlation” is invoked to compute the corrected sum of squares and crossproducts matrix. Then, RCOV is invoked to compute the regression coefficient estimates, the R matrix, and the sum of squares for error.