hemreg Extract H and E matrices for multivariate regression hemreg

SAS Macro Programs: hemreg

$Version: 1.1 (12 Oct 2006 14:17:54)
Michael Friendly
York University


The hemreg macro ( [download] get hemreg.sas)

Extract H and E matrices for multivariate regression

The HEMREG macro extracts hypothesis (H) and error (E) matrices for an overall test in a multivariate regression analysis, in a form similar to that provided by the OUTSTAT= option with PROC GLM. This is typically used with the HEPLOT macro, or the MPOWER macro for MMRA.

Method

For a multivariate regression analysis, using

  proc glm outstat=stats;
     model y1 y2 y3 = x1-x5;

PROC GLM will produce 5 separate 3x3, 1 df SSCP matrices for the separate predictors X1-X5, in the OUTSTAT= data set, but no SSCP matrix for the overall multivariate test. The HEMREG macro uses PROC REG instead, obtains the HypothesisSSCP and ErrorSSCP tables using ODS, and massages these into the same format used by PROC GLM.

Usage

The HEMREG macro is defined with keyword parameters. The Y= and X= parameters are required. One or more overall hypotheses involving subsets of the X= variables may be specified with the MTEST= parameter. The arguments may be listed within parentheses in any order, separated by commas. For example:

  %hemreg(y=SAT PPVT RAVEN, x=N S NS NA SS);
  %hemreg(y=SAT PPVT RAVEN, x=N S NS NA SS, mtest=%str(N,S,NS), hyp=N:S:NS);

Parameters

DATA=
Name of input dataset [Default: DATA=_LAST_]
Y=
List of response variables. Must be an explicit, blank-seaparated list of variable names, and all variables must be numeric.
X=
List of predictor variables. Must be an explicit, blank-seaparated list of variable names, and all variables must be numeric.
HYP=
Name for each overall hypothesis tested, corresponding to the test(s) specified in the MTEST= parameter (to be used as the EFFECT= parameter in the HEPLOT macro). [Default: HYP=H1]
MTEST=
If MTEST= is not specified (the default), a multivariate test of all X= predictors is carried out, giving an overall H matrix. Otherwise, MTEST= can specify one or more multivariate tests of subsets of the predictors, separated by '/', where the variables within each subset are separated by ','. In this case, the embedded ','s must be protected by surrounting the parameter value in %str(). For example,
            MTEST = %str(group / x1, x2, x3 / x4, x5)

In this case you might specify HYP=Group X1:X3 X4:X5 to name the H matrices.

SS=
Type of SSCP matrices to compute: Either SS1 or SS2, corresponding to sequential and partial SS computed by PROC REG. If SS=SS2, the _TYPE_ variable in the output data set is changed to _TYPE_='SS3' to conform with PROC GLM. [Default: SS=SS2]
OUT=
The name of output HE dataset [Default: OUT=HE]

Example

%include macros(hemreg);        *-- or include in an autocall library;
%include data(lo_ses);
%hemreg(data=lo_ses, y=SAT PPVT RAVEN, x=N S NS NA SS, out=he);
The output is
  _NAME_   _source_   _type_            SAT           PPVT          RAVEN   DF

  SAT       H1        SS3       3653.773237   2159.9966058    63.36802958    5
  PPVT      H1        SS3      2159.9966058    2883.675904   281.48417619    5
  RAVEN     H1        SS3       63.36802958   281.48417619   76.528604456    5
  SAT       ERROR     ERROR     13929.52406   1530.5169077   457.19953799   31
  PPVT      ERROR     ERROR    1530.5169077   2764.7565284   213.67798597   31
  RAVEN     ERROR     ERROR    457.19953799   213.67798597   268.28220636   31

See also

hemat HE plots for all pairs of response variables
heplot Plot Hypothesis and Error matrices for a bivariate MANOVA effect
meanplot Plot means for factorial designs
panels Display a set of plots in rectangular panels
stat2dat Convert summary dataset to raw data equivalent