MVIND

 


   more...

Computes a test for the independence of k sets of multivariate normal variables.

Required Arguments

NDF — Number of degrees of freedom in COV. (Input)

COVNVAR by NVAR variance‑covariance matrix. (Input)

NVSET — Index vector of length NGROUP. (Input)
NVSET(i) gives the number of variables in the i‑th set of variables. The first NVSET(1) variables in COV define the first set of covariates, the next NVSET(2) variables define the second set of covariates, etc.

STAT — Vector of length 4 containing the output statistics. (Output)

 

I

STAT(I)

1

Statistic V for testing the hypothesis of independence of the NGROUP sets of variables.

2

Chi‑squared statistic associated with V.

3

Degrees of freedom for STAT(2).

4

Probability of exceeding STAT(2) under the null hypothesis of independence.

Optional Arguments

NVAR — Number of variables in the covariance matrix. (Input)
Default: NVAR = size (COV,2).

LDCOV — Leading dimension of COV exactly as specified in the dimension statement in the calling program. (Input)
Default: LDCOV = size (COV,1).

NGROUP — Number of sets of variables to be tested for independence. (Input)
Default: NGROUP = size (NVSET,1).

FORTRAN 90 Interface

Generic: CALL MVIND (NDF, COV, NVSET, STAT [])

Specific: The specific interface names are S_MVIND and D_MVIND.

FORTRAN 77 Interface

Single: CALL MVIND (NDF, NVAR, COV, LDCOV, NGROUP, NVSET, STAT)

Double: The double precision name is DMVIND.

Description

Routine MVIND computes a likelihood ratio test statistic proposed by Wilks (1935) for testing the independence of NGROUP sets of multivariate normal variates. The likelihood ratio statistic is computed as the ratio of the determinant S of the sample covariance matrix to the product of the determinants S1∣…∣SK of the covariance matrices of each of the k = NGROUP sets of variates. An asymptotic chi‑squared statistic obtained from the likelihood ratio, along with corresponding p‑value, is computed according to formulas given by Morrison (1976, pages 258‑259). The chi‑squared statistic is computed as:

 

where n = NDF,

 

where Sii is the determinant of the i‑th covariance matrix, k = NGROUP, and pi = NVSET(i), and S is the determinant of COV.

Because determinants appear in both the numerator and denominator of the likelihood ratio, the test statistic is unchanged when correlation matrices are substituted for covariance matrices as input to MVIND.

In using MVIND, the covariance matrix must first be computed (possibly via routine CORVC, see Chapter 3, “Correlation”). The covariance matrix may then need to be rearranged (possible via routine RORDM) so that the NVSET(1) variables in the first set correspond to the first NVSET(1) columns (and rows) of the covariance matrix, with the next NVSET(2) columns and rows containing the variables for the second set of variables, etc. With this special arrangement of the covariance matrix, routine MVIND may then be called.

Comments

1. Workspace may be explicitly provided, if desired, by use of M2IND/DM2IND. The reference is:

CALL M2IND (NDF, NVAR, COV, LD COV, NGROUP, NVSET, STAT, FACT, WK, IPVT)

The additional arguments are as follows:

FACT — Work vector of length NVAR2.

WK — Work vector of length NVAR.

IPVT — Work vector of length NVAR.

2. Informational errors

 

Type

Code

Description

4

1

A covariance matrix for a subset of the variables is singular.

4

2

The covariance matrix for all variables is singular.

Example

The example is taken from Morrison (1976, page 258). It involves two sets of covariates, with each set having two covariates. The null hypothesis of no relationship is rejected.

 

USE MVIND_INT

USE UMACH_INT

 

IMPLICIT NONE

INTEGER LDCOV, NDF, NGROUP, NVAR

PARAMETER (NDF=932, NGROUP=2, NVAR=4, LDCOV=NVAR)

!

INTEGER NOUT, NVSET(NGROUP)

REAL COV(NVAR,NVAR), STAT(4)

!

DATA COV/1.00, 0.45, -0.19, 0.43, 0.45, 1.00, -0.02, 0.62, &

-0.19, -0.02, 1.00, -0.29, 0.43, 0.62, -0.29, 1.00/

!

DATA NVSET/2, 2/

!

CALL MVIND (NDF, COV, NVSET, STAT)

!

CALL UMACH (2, NOUT)

WRITE (NOUT,99999) STAT

99999 FORMAT (' Likelihood ratio ........... ', F12.4, /, ' ', &

'Chi-squared ................ ', F9.1, /, ' Degrees of '&

, 'freedom ......... ', F9.1, /, ' p-value ', &

'.................... ', F12.4)

END

Output

 

Likelihood ratio ........... 0.5497

Chi-squared ................ 556.2

Degrees of freedom ......... 4.0

p-value .................... 0.0000