>  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_HYPOTH_SCPH

IMSL_HYPOTH_SCPH

IMSL_HYPOTH_PARTIAL

The IMSL_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.

This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.

The IMSL_HYPOTH_SCPH function 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, IMSL_HYPOTH_PARTIAL 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 W = HβU - G.
  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| > |t111|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 β.

  7. 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 you to correct the hypothesis before any meaningful sums of squares from this function can be computed. However, in some cases, You may know the hypothesis is consistent and completely testable, but the checks in IMSL_HYPOTH_SCPH are too tight. For this reason, IMSL_HYPOTH_SCPH continues with the calculations.

    IMSL_HYPOTH_SCPH gives a matrix of sums of squares and crossproducts that could also be obtained from separate fittings of the two models:

    Y = Xβ + ε (1)

    Aβ = Z

    Hβ = G

    and:

    Y = Xβ + ε (2)

    Aβ = Z

    where: Y = YU , β = βU , ε = εU , and Z = ZU. 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 IMSL_MULTIREGRESS and the results stored in the structure Info_v. The sum of squares and crossproducts matrix, scph, is then computed by calling IMSL_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	=	IMSL_MULTIREGRESS(x, y, Predict_Info = p)
scph	=	IMSL_HYPOTH_SCPH(p, h, Dfh = dfh)
PRINT, 'Degrees of Freedom Hypothesis =', dfh

IDL prints:

Degrees of Freedom Hypothesis =	1.00000

Continue:

PM, scph, Title = 'Sum of Squares and Crossproducts' 

IDL prints:

Sum of Squares and Crossproducts
100.000	-40.0000
-40.0000	16.0000

Errors


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.

Syntax


Result = IMSL_HYPOTH_SCPH(Info_v, H [, DFH=variable] [, /DOUBLE] [, G=array] [, U=array])

Return Value


Two-dimensional array, scph, containing the sums of squares and crossproducts attributable to the hypothesis.

Arguments


Info_v

One-dimensional array of type BYTE containing information about the regression fit. See IMSL_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.

Keywords


DFH (optional)

Named variable containing the degrees of freedom for the sums of squares and crossproducts matrix. This is equal to the rank of input matrix h.

DOUBLE (optional)

If present and nonzero, double precision is used.

G (optional)

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 (optional)

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

Version History


6.4

Introduced



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us