RHPTE
Performs tests for a multivariate general linear hypothesis H BU = G given the hypothesis sums of squares and crossproducts matrix SH and the error sums of squares and crossproducts matrix SE.
Required Arguments
DFE — Degrees of freedom for error matrix SCPE. (Input)
SCPE — NDEP by NDEP matrix SE containing sums of squares and crossproducts for error. (Input)
DFH — Degrees of freedom for hypothesis matrix SH. (Input)
SCPH — Matrix SH containing sums of squares and crossproducts attributable to the hypothesis. (Input)
If NU = 0, SH is a NDEP by NDEP matrix; otherwise, SH is a NU by NU matrix.
TEST — Vector of length 8 containing test statistics and p‑values for the hypothesis
H BU = G. (Output)
Elem |
Description |
1, 5 |
Wilks’ lambda and p‑value |
2, 6 |
Roy’s maximum root criterion and p‑value |
3, 7 |
Hotelling’s trace and p‑value |
4, 8 |
Pillai’s trace and p‑value |
Optional Arguments
NDEP — Number of dependent variables. (Input)
Default: NDEP = size (SCPE,2).
LDSCPE — Leading dimension of SCPE exactly as specified in the dimension statement in the calling program. (Input)
Default: LDSCPE = size (SCPE,1).
NU — U matrix option. (Input)
For positive NU, NU is the number of linear combinations of the dependent variables to be considered. If NU = 0, the hypothesis is HB = G, i.e., U is automatically taken to be the identity.
Default: NU = 0.
U — NDEP by NU matrix used to test H BU = G. (Input, if NU is positive)
The rank of the matrix U must equal the number of columns. If NU = 0, U is not referenced and can be a 1 × 1 array.
Default: U is a 1 × 1 array.
LDU — Leading dimension of U exactly as specified in the dimension statement in the calling program. (Input)
Default: LDU = size(U, 1).
LDSCPH — Leading dimension of SCPH exactly as specified in the dimension statement in the calling program. (Input)
Default: LDSCPH = size (SCPH,1).
FORTRAN 90 Interface
Generic: CALL RHPTE (DFE, SCPE, DFH, SCPH, TEST [, …])
Specific: The specific interface names are S_RHPTE and D_RHPTE.
FORTRAN 77 Interface
Single: CALL RHPTE (DFE, NDEP, SCPE, LDSCPE, NU, U, LDU, DFH, SCPH, LDSCPH, TEST)
Double: The double precision name is DRHPTE.
Description
Routine RHPTE computes test statistics and p‑values for the general linear hypothesis H BU = G for the multivariate general linear model. See the section “Multivariate General Linear Model” in the chapter introduction.
Routines RGLM, RGIVN, RLEQU, and RCOV can be used to compute the fit of the general linear model prior to invoking RHPTE. The error sum of squares and crossproducts matrix (SCPE) is required for input to RHPTE. In addition, the hypothesis sum of squares and crossproducts matrix (SCPH), which can be computed using routine RHPSS, is required for input to RHPTE.
The hypothesis sum of squares and crossproducts matrix input in SCPH is
where C is a solution to RTC = H and where D is a diagonal matrix with diagonal elements
See the section “Linear Dependence and the R Matrix” in the chapter introduction.
The error sum of squares and crossproducts matrix for the model Y = XB + E is
which is input in SCPE. The error sum of squares and crossproducts matrix for the hypothesis H BU = G computed by RHPTE is
Let p equal the order of the matrices SE and SH, i.e.,
Let q (stored in DFH) be the degrees of freedom for the hypothesis. Let v (stored in DFE) be the degrees of freedom for error. Routine RHTPE computes three test statistics based on eigenvalues λi (i = 1, 2, …, p) of the generalized eigenvalue problem SHx = λSEx. These test statistics are as follows:
Wilks’ lambda
Λ is output in TEST(1). The p‑value output in TEST(5) is based on an approximation discussed by Rao (1973, page 556). The statistic
has an approximate F distribution with pq and ms ‑ pq/2 + 1 numerator and denominator degrees of freedom, respectively, where
and
m = v ‑ (p ‑ q + 1)/2
The F test is exact if min(p, q) ≤ 2 (Kshirsagar 1972, Theorem 4, pages 299‑300).
Roy’s maximum root
c is output in TEST(2). The p‑value output in TEST(6) is based on the approximation
where s = max(p, q) has an approximate F distribution with s and v + q ‑ s numerator and denominator degrees of freedom, respectively. The F test is exact if s = 1, and then the p‑value output in TEST(7) is exact. In general, the value output in TEST(7) is a lower bound on the actual p‑value.
Hotelling’s trace
U is output in TEST(3). The p‑value output in TEST(7) is based on the approximation of McKeon (1974) that supersedes the approximation of Hughes and Saw (1972). McKeon’s approximation is also discussed by Seber (1984, page 39). For
the p‑value output in TEST(7) is based on the result that
has an approximate F distribution with pq and b degrees of freedom. The test is exact if min(p, q) = 1. For v ≤ p + 1, the approximation is not valid, and TEST(7) is set to NaN (not a number).
These three test statistics are valid when SE is positive definite. A necessary condition for SE to be positive definite is v ≥ p. If SE is not positive definite, a warning error message with error code 1 is issued, and the entries in TEST corresponding to the computed test statistics and p‑values are set to NaN (not a number).
Because the requirement v ≥ p can be a serious drawback, RHTPE computes a fourth test statistic based on eigenvalues θi(i = 1, 2, …, p) of the generalized eigenvalue problem SHw = θ (SH + SE)w. This test statistic requires a less restrictive assumption—SH + SE is positive definite. A necessary condition for SH + SE to be positive definite is v + q ≥ p. If SE is positive definite, RHPTE avoids the computation of this generalized eigenvalue problem from scratch. In this case, the eigenvalues θ i are obtained from λi by
The fourth test statistic is as follows:
Pillai’s trace
V is output in TEST(4). The p‑value output in TEST(8) is based on an approximation discussed by Pillai (1985). The statistic
has an approximate F distribution with s(2m + s + 1) and s(2n + s + 1) numerator and denominator degrees of freedom, respectively, where
The F test is exact if min(p, q) = 1.
Comments
1. Workspace may be explicitly provided, if desired, by use of R2PTE/DR2PTE. The reference is:
CALL R2PTE (DFE, NDEP, SCPE, LDSCPE, NU, U, LDU, DFH, SCPH, LDSCPH, TEST, WK)
The additional argument is:
WK — Work vector of length 2 * p2 + 2 * p + NDEP + 2 * NU2
2. Informational errors
Type |
Code |
Description |
3 |
1 |
UTSEU is singular. Only the Pillai trace statistic can be computed. Other statistics are set to NaN. |
4 |
2 |
UTSEU + SH is singular. No tests can be computed. |
4 |
3 |
Iterations for eigenvalues for the generalized eigenvalue problem SHx = λ(SH + UTSEU)x failed to converge. Statistics cannot be computed. |
Example
The data for the example are taken from Maindonald (1984, pages 203‑204). The data are stored in the matrix X. A multivariate regression model containing two dependent variables and three independent variables is fit using routine RGIVN. The sum of squares and crossproducts matrix is computed for the third independent variable in the model using RHPSS. Routine RHPTE is used to test whether the third independent variable should be included in the regression.
USE IMSL_LIBRARIES
IMPLICIT NONE
INTEGER LDB, LDG, LDH, LDR, LDSCPE, LDSCPH, LDU, LDX, &
NCOEF, NCOL, NDEP, NH, NIND, NROW, J, INTCEP, IIND
PARAMETER (INTCEP=1, LDU=1, NCOL=5, NDEP=2, NH=1, NIND=3, &
NROW=9, LDG=NH, LDH=NH, LDSCPE=NDEP, LDSCPH=NDEP, &
LDX=NROW, NCOEF=INTCEP+NIND, LDB=NCOEF, LDR=NCOEF)
!
INTEGER IDEP, IND, INDDEP(1), INDIND(1)
REAL B(LDB,NDEP), DFE, DFH, G(LDG,NDEP), &
H(LDH,NCOEF), R(LDR,NCOEF), SCPE(LDSCPE,NDEP), &
SCPH(LDSCPH,NDEP), TEST(8), X(LDX,NCOL)
CHARACTER CLABEL(3)*14, RLABEL(4)*9
!
DATA (X(1,J),J=1,NCOL)/7.0, 5.0, 6.0, 7.0, 1.0/
DATA (X(2,J),J=1,NCOL)/2.0, -1.0, 6.0, -5.0, 4.0/
DATA (X(3,J),J=1,NCOL)/7.0, 3.0, 5.0, 6.0, 10.0/
DATA (X(4,J),J=1,NCOL)/-3.0, 1.0, 4.0, 5.0, 5.0/
DATA (X(5,J),J=1,NCOL)/2.0, -1.0, 0.0, 5.0, -2.0/
DATA (X(6,J),J=1,NCOL)/2.0, 1.0, 7.0, -2.0, 4.0/
DATA (X(7,J),J=1,NCOL)/-3.0, -1.0, 3.0, 0.0, -6.0/
DATA (X(8,J),J=1,NCOL)/2.0, 1.0, 1.0, 8.0, 2.0/
DATA (X(9,J),J=1,NCOL)/2.0, 1.0, 4.0, 3.0, 0.0/
DATA H/3*0.0, 1.0/, G/0.0, 0.0/
DATA RLABEL/'Wilks', 'Roy', 'Hotelling', 'Pillai'/
DATA CLABEL/' ', 'Test statistic', 'p-value'/
!
IIND = -NIND
IDEP = -NDEP
CALL RGIVN (X, IIND, INDIND, IDEP, INDDEP, B, R=R, DFE=DFE, SCPE=SCPE)
CALL RHPSS (H, B, G, R, SCPH, DFH=DFH)
CALL RHPTE (DFE, SCPE, DFH, SCPH, TEST)
CALL WRRRL (' ', TEST, RLABEL, CLABEL, 4, 2, 4, FMT= '(F14.3, F9.6)')
END
Output
Test statistic p-value
Wilks 0.003 0.000010
Roy 316.601 0.000010
Hotelling 316.601 0.000010
Pillai 0.997 0.000010