HYPOTH_SCPH Function
Computes the matrix of sums of squares and crossproducts for the multivariate general linear hypothesis HβU = G given the regression fit.
Usage
result = HYPOTH_SCPH(info_v, h)
Input Parameters
info_v—One-dimensional array of type BYTE containing information about the regression fit. See function MULTIREGRESS.
h—Two-dimensional array of size nh by n_coefficients with each row corresponding to a row in the hypothesis and containing the constants that specify a linear combination of the regression coefficients. Here, n_coefficients is the number of coefficients in the fitted regression model.
Returned Value
result—Two-dimensional array, scph, containing the sums of squares and crossproducts attributable to the hypothesis.
Input Keywords
Double—If present and nonzero, double precision is used.
G—Two-dimensional array of size nh by nu containing the G matrix, the null hypothesis values. By default, each value of G is equal to 0.
U—Two-dimensional array of size n_dependent by nu containing the U matrix for the test HpβU = Gp where nu is the number of linear combinations of the dependent variables to be considered. The value nu must be greater than 0 and less than or equal to n_dependent. Default: nu = n_dependent and U is the identity matrix
Output Keywords
Dfh—Named variable into which the degrees of freedom for the sums of squares and crossproducts matrix is stored. This is equal to the rank of input matrix h.
Discussion
Function HYPOTH_SCPH computes the matrix of sums of squares and crossproducts for the general linear hypothesis HβU = G for the multivariate general linear model Y = Xβ + ε.
The rows of H must be linear combinations of the rows of R, i.e., Hβ = G must be completely testable. If the hypothesis is not completely testable, the HYPOTH_PARTIAL Function can be used to construct an equivalent completely testable hypothesis.
Computations are based on an algorithm discussed by Kennedy and Gentle (1980, p. 317) that is extended by Sallas and Lionti (1988) for multivariate non-full rank models with possible linear equality restrictions. The algorithm is as follows:
1. Form:
2. Find C as the solution of RTC = HT. If the equations are declared inconsistent within a computed tolerance, a warning error message is issued that the hypothesis is not completely testable.
3. For all rows of R corresponding to restrictions, i.e., containing negative diagonal elements from a restricted least-squares fit, zero out the corresponding rows of C, i.e., from DC.
4. Decompose DC with Householder transformations and column pivoting for a square, upper triangular matrix T with diagonal elements of nonincreasing magnitude and permutation matrix P such that:
where Q is an orthogonal matrix.
5. Determine the rank of T, say r. If t11 = 0, then r = 0. Otherwise, the rank of T is r if:
| trr | > | t11 | ε 1 | tr + 1, r + 1 |
where ε = 10.0 * (machine epsilon).
Then, zero out all rows of T below r. Set the degrees of freedom for the hypothesis, Dfh, to r.
6. Find V as a solution to TTV = PTW. If the equations are inconsistent, a warning error message is issued that the hypothesis is inconsistent within a computed tolerance, i.e., the linear system:
Hβ U = G
Ab = Z
does not have a solution for β.
Form VTV, which is the required matrix of sum of squares and crossproducts, scph.
In general, the two warning errors described above are serious user errors that require the user to correct the hypothesis before any meaningful sums of squares from this function can be computed. However, in some cases, the user may know the hypothesis is consistent and completely testable, but the checks in HYPOTH_SCPH are too tight. For this reason, HYPOTH_SCPH continues with the calculations.
HYPOTH_SCPH gives a matrix of sums of squares and crossproducts that could also be obtained from separate fittings of the two models:
and:
where , , , and . The error sum of squares and crossproducts matrix for (1) minus that for (2) is the matrix sum of squares and crossproducts output in scph. Note that this approach avoids the question of testability.
Example
The data for this example are from Maindonald (1984, pp. 203204). A multivariate regression model containing two dependent variables and three independent variables is fit using function MULTIREGRESS and the results stored in the structure info_v. The sum of squares and crossproducts matrix, scph, is then computed by calling HYPOTH_SCPH for the test that the third independent variable is in the model (determined by the specification of h). The degrees of freedom for scph also is computed.
x  =  TRANSPOSE([[7.0, 5.0, 6.0], [2.0, -1.0, 6.0], $
   [7.0, 3.0, 5.0], [-3.0, 1.0, 4.0], [2.0, -1.0, 0.0], $
   [2.0, 1.0, 7.0], [-3.0, -1.0, 3.0], [2.0, 1.0, 1.0], $
   [2.0, 1.0, 4.0]])
y  =  TRANSPOSE([[7.0, 1.0], [-5.0, 4.0], [6.0, 10.0], $
   [5.0, 5.0],[5.0, -2.0], [-2.0, 4.0], [0.0, -6.0], $
   [8.0, 2.0], [3.0, 0.0]])
h  =  FLTARR(1, 4)
h(*)  =  0
h(0,  3)  =  1.0
coefs  =  MULTIREGRESS(x, y, Predict_Info = p)
scph  =  HYPOTH_SCPH(p, h, Dfh = dfh)
PRINT, 'Degrees of Freedom Hypothesis =', dfh
; PV-WAVE prints: Degrees of Freedom Hypothesis =      1.00000
PM, scph, Title = 'Sum of Squares and Crossproducts'
; PV-WAVE prints the following:
; Sum of Squares and Crossproducts
;      100.000     -40.0000
;      -40.0000      16.0000
Warning Errors
STAT_HYP_NOT_TESTABLE—The hypothesis is not completely testable within the computed tolerance. Each row of “h” must be a linear combination of the rows of “r”.
STAT_HYP_NOT_CONSISTENT—The hypothesis is inconsistent within the computed tolerance.