The HPMIXED Procedure

RANDOM Statement

  • RANDOM random-effects </ options>;

The RANDOM statement defines the random effects in the mixed model. It can be used to specify traditional variance component models (as in the VARCOMP procedure) and to specify random coefficients. The random effects can be classification or continuous. Multiple RANDOM statements are possible. Random effects specified in a RANDOM statement could be correlated with each other for certain types of covariance structures (see the TYPE= option). It is, however, assumed that random effects specified using different RANDOM statements are not correlated.

Using notation from the section Model Assumptions, the purpose of the RANDOM statement is to define the bold upper Z matrix of the mixed model, the random effects in the bold-italic gamma vector, and the structure of bold upper G. The bold upper Z matrix is constructed exactly like the bold upper X matrix for the fixed effects, and the bold upper G matrix is constructed to correspond to the effects constituting bold upper Z. The structure of bold upper G is defined by using the TYPE= option.

You can specify INTERCEPT (or INT) as a random effect. PROC HPMIXED does not include the intercept in the RANDOM statement by default, as it does in the MODEL statement.

You can specify the following options in the RANDOM statement after a slash (/).

ALPHA=number

requests that a t-type confidence interval with confidence level 1 minus sans-serif-italic number be constructed for the predictors of random effects in this statement. The value of number must be between 0 and 1 exclusively; the default is 0.05. Specifying the ALPHA= option implies the CL option.

CL

requests that t-type confidence limits be constructed for each of the predictors of random effects in this statement. The confidence level is 0.95 by default; this can be changed with the ALPHA= option. The CL option implies the SOLUTION option.

GROUP=effect

defines an effect specifying heterogeneity in the covariance structure of bold upper G. All observations having the same level of the group effect have the same covariance parameters. Each new level of the group effect produces a new set of covariance parameters with the same structure as the original group. You should exercise caution in defining the group effect, because strange covariance patterns can result from its misuse. Also, the group effect can greatly increase the number of estimated covariance parameters, which can adversely affect the optimization process.

Continuous variables are permitted as arguments to the GROUP= option. PROC HPMIXED does not sort by the values of the continuous variable; rather, it considers the data to be from a new group whenever the value of the continuous variable changes from the previous observation. Using a continuous variable decreases execution time for models with a large number of groups and also prevents the production of a large "Class Levels Information" table.

NOFULLZ

eliminates the columns in bold upper Z corresponding to missing levels of random effects involving CLASS variables. By default, these columns are included in bold upper Z. It is sufficient to specify the NOFULLZ option in any RANDOM statement.

SOLUTION

requests that the solution for the random-effects parameters be produced. Using notation from the section Model Assumptions, these estimates are the empirical best linear unbiased predictors (BLUPs) ModifyingAbove bold-italic gamma With caret equals ModifyingAbove bold upper G With caret bold upper Z prime ModifyingAbove bold upper V With caret Superscript negative 1 Baseline left-parenthesis bold y minus bold upper X ModifyingAbove bold-italic beta With caret right-parenthesis. They can be useful for comparing the random effects from different experimental units and can also be treated as residuals in performing diagnostics for your mixed model.

The numbers displayed in the SE Pred column of the "Solution for Random Effects" table are not the standard errors of the ModifyingAbove bold-italic gamma With caret displayed in the Estimate column; rather, they are the standard errors of predictions ModifyingAbove bold-italic gamma With caret Subscript i Baseline minus bold-italic gamma Subscript i, where ModifyingAbove bold-italic gamma With caret Subscript i is the ith BLUP and bold-italic gamma Subscript i is the ith random-effect parameter.

SUBJECT=effect

identifies the subjects in your mixed model. Complete independence is assumed across subjects; thus, for the RANDOM statement, the SUBJECT= option produces a block-diagonal structure in bold upper G with identical blocks. The bold upper Z matrix is modified to accommodate this block-diagonality. In fact, specifying a subject effect is equivalent to nesting all other effects in the RANDOM statement within the subject effect.

Continuous variables are permitted as arguments to the SUBJECT= option. PROC HPMIXED does not sort by the values of the continuous variable; rather, it considers the data to be from a new subject whenever the value of the continuous variable changes from the previous observation. Using a continuous variable decreases execution time for models with a large number of subjects and also prevents the production of a large "Class Levels Information" table.

TYPE=covariance-structure

specifies the structure of the covariance matrix bold upper G for random effects. The default structure is VC.

If you want different covariance structures in different parts of bold upper G, you must use multiple RANDOM statements with different TYPE= options.

Valid values for covariance-structure are listed in Table 7. Examples are shown in Table 8.

Table 7: Covariance Structures

Structure Description Parameters left-parenthesis i comma j right-parenthesis element
AR(1) Autoregressive(1) 2 sigma squared rho Superscript StartAbsoluteValue i minus j EndAbsoluteValue
CHOL Cholesky root t left-parenthesis t plus 1 right-parenthesis slash 2 l Subscript i j
CS Compound symmetry (CS) 2 sigma 1 plus sigma squared 1 left-parenthesis i equals j right-parenthesis
CSH Heterogeneous CS t plus 1 sigma Subscript i Baseline sigma Subscript j Baseline left-bracket rho Baseline 1 left-parenthesis i not-equals j right-parenthesis plus 1 left-parenthesis i equals j right-parenthesis right-bracket
TOEP(1) Toeplitz(1) 1 sigma squared
UC Uniform correlation (UC) 2 sigma squared left-bracket rho Baseline 1 left-parenthesis i not-equals j right-parenthesis plus 1 left-parenthesis i equals j right-parenthesis right-bracket
UCH Heterogeneous UC t plus 1 sigma Subscript i Baseline sigma Subscript j Baseline left-bracket rho Baseline 1 left-parenthesis i not-equals j right-parenthesis plus 1 left-parenthesis i equals j right-parenthesis right-bracket
UN Unstructured t left-parenthesis t plus 1 right-parenthesis slash 2 sigma Subscript i j
VC Variance components q sigma Subscript k Superscript 2 Baseline 1 left-parenthesis i equals j right-parenthesis
and i,j correspond to kth effect


In Table 7, t is the overall dimension of the covariance matrix, and 1 left-parenthesis upper A right-parenthesis equals 1 when A is true and 0 otherwise. For example, 1(i = j) equals 1 when i = j and equals 0 otherwise. TYPE=UCH is the same as TYPE=CSH.

Table 8 lists some examples of the structures in Table 7.

Table 8: Covariance Structure Examples

Description Structure Example
First-order
autoregressive
AR(1) sigma squared Start 4 By 4 Matrix 1st Row 1st Column 1 2nd Column rho 3rd Column rho squared 4th Column rho cubed 2nd Row 1st Column rho 2nd Column 1 3rd Column rho 4th Column rho squared 3rd Row 1st Column rho squared 2nd Column rho 3rd Column 1 4th Column rho 4th Row 1st Column rho cubed 2nd Column rho squared 3rd Column rho 4th Column 1 EndMatrix
Cholesky
root
CHOL Start 4 By 4 Matrix 1st Row 1st Column l 11 2nd Column 0 3rd Column 0 4th Column 0 2nd Row 1st Column l 21 2nd Column l 22 3rd Column 0 4th Column 0 3rd Row 1st Column l 31 2nd Column l 32 3rd Column l 33 4th Column 0 4th Row 1st Column l 41 2nd Column l 42 3rd Column l 43 4th Column l 44 EndMatrix Start 4 By 4 Matrix 1st Row 1st Column l 11 2nd Column l 21 3rd Column l 31 4th Column l 41 2nd Row 1st Column 0 2nd Column l 22 3rd Column l 32 4th Column l 42 3rd Row 1st Column 0 2nd Column 0 3rd Column l 33 4th Column l 43 4th Row 1st Column 0 2nd Column 0 3rd Column 0 4th Column l 44 EndMatrix
Compound
symmetry
CS Start 4 By 4 Matrix 1st Row 1st Column sigma squared plus sigma 1 2nd Column sigma 1 3rd Column sigma 1 4th Column sigma 1 2nd Row 1st Column sigma 1 2nd Column sigma squared plus sigma 1 3rd Column sigma 1 4th Column sigma 1 3rd Row 1st Column sigma 1 2nd Column sigma 1 3rd Column sigma squared plus sigma 1 4th Column sigma 1 4th Row 1st Column sigma 1 2nd Column sigma 1 3rd Column sigma 1 4th Column sigma squared plus sigma 1 EndMatrix
Banded Toeplitz TOEP(1) Start 4 By 4 Matrix 1st Row 1st Column sigma squared 2nd Column 0 3rd Column 0 4th Column 0 2nd Row 1st Column 0 2nd Column sigma squared 3rd Column 0 4th Column 0 3rd Row 1st Column 0 2nd Column 0 3rd Column sigma squared 4th Column 0 4th Row 1st Column 0 2nd Column 0 3rd Column 0 4th Column sigma squared EndMatrix
Uniform
correlation
UC sigma squared Start 4 By 4 Matrix 1st Row 1st Column 1 2nd Column rho 3rd Column rho 4th Column rho 2nd Row 1st Column rho 2nd Column 1 3rd Column rho 4th Column rho 3rd Row 1st Column rho 2nd Column rho 3rd Column 1 4th Column rho 4th Row 1st Column rho 2nd Column rho 3rd Column rho 4th Column 1 EndMatrix
Heterogeneous
UC
UCH Start 4 By 4 Matrix 1st Row 1st Column sigma 1 squared 2nd Column sigma 1 sigma 2 rho 3rd Column sigma 1 sigma 3 rho 4th Column sigma 1 sigma 4 rho 2nd Row 1st Column sigma 2 sigma 1 rho 2nd Column sigma 2 squared 3rd Column sigma 2 sigma 3 rho 4th Column sigma 2 sigma 4 rho 3rd Row 1st Column sigma 3 sigma 1 rho 2nd Column sigma 3 sigma 2 rho 3rd Column sigma 3 squared 4th Column sigma 3 sigma 4 rho 4th Row 1st Column sigma 4 sigma 1 rho 2nd Column sigma 4 sigma 2 rho squared 3rd Column sigma 4 sigma 3 rho 4th Column sigma 4 squared EndMatrix
Unstructured UN Start 4 By 4 Matrix 1st Row 1st Column sigma 1 squared 2nd Column sigma 21 3rd Column sigma 31 4th Column sigma 41 2nd Row 1st Column sigma 21 2nd Column sigma 2 squared 3rd Column sigma 32 4th Column sigma 42 3rd Row 1st Column sigma 31 2nd Column sigma 32 3rd Column sigma 3 squared 4th Column sigma 34 4th Row 1st Column sigma 41 2nd Column sigma 42 3rd Column sigma 43 4th Column sigma 4 squared EndMatrix
Variance
components
VC (default) Start 4 By 4 Matrix 1st Row 1st Column sigma Subscript upper A Superscript 2 2nd Column 0 3rd Column 0 4th Column 0 2nd Row 1st Column 0 2nd Column sigma Subscript upper A Superscript 2 3rd Column 0 4th Column 0 3rd Row 1st Column 0 2nd Column 0 3rd Column sigma Subscript upper B Superscript 2 4th Column 0 4th Row 1st Column 0 2nd Column 0 3rd Column 0 4th Column sigma Subscript upper B Superscript 2 EndMatrix


The variances and covariances in the formulas that follow in the TYPE= option descriptions are expressed in terms of generic random variables xi Subscript i and xi Subscript j. They represent random effects for which the bold upper G matrices are constructed.

The following list provides some further information about these covariance-structures:

AR(1)

specifies a first-order autoregressive structure,

normal upper C normal o normal v left-bracket xi Subscript i Baseline comma xi Subscript j Baseline right-bracket equals sigma squared rho Superscript StartAbsoluteValue i minus j EndAbsoluteValue

The values i and j are derived for the ith and jth observations, respectively. For example, in the following statements the values correspond to the class levels for the time effect of the ith and jth observation within a particular subject:

proc hpmixed;
   class time patient;
   model y = x x*x;
   random time / sub=patient type=ar(1);
run;

PROC HPMIXED imposes the constraint StartAbsoluteValue rho EndAbsoluteValue less-than 1 for stationarity.

CHOL

specifies an unstructured variance-covariance matrix parameterized through its Cholesky root. All diagonal values are constrained to be positive. This parameterization guarantees a positive definite covariance matrix. For example, a 2 times 2 unstructured covariance matrix can be written as

normal upper V normal a normal r left-bracket bold-italic xi right-bracket equals Start 2 By 2 Matrix 1st Row 1st Column sigma 1 squared 2nd Column sigma 21 2nd Row 1st Column sigma 21 2nd Column sigma 2 squared EndMatrix

Without imposing constraints on the three parameters, there is no guarantee that the estimated variance matrix is positive definite. Even if sigma 1 squared and sigma 2 squared are nonzero, a large value for sigma 21 can lead to a negative eigenvalue of normal upper V normal a normal r left-bracket bold-italic xi right-bracket. The Cholesky root of a positive definite matrix bold upper A is a lower triangular matrix bold upper L such that bold upper L bold upper L Superscript prime Baseline equals bold upper A. The Cholesky root of the above 2 times 2 matrix can be written as

bold upper L equals Start 2 By 2 Matrix 1st Row 1st Column l 11 2nd Column 0 2nd Row 1st Column l 21 2nd Column l 22 EndMatrix

The elements of the unstructured variance matrix are then simply sigma 1 squared equals l 11 squared, sigma 21 equals l 21 l 11, and sigma 2 squared equals l 21 squared plus l 22 squared. Similar operations yield the generalization to covariance matrices of higher orders.

For example, the following statements model the covariance matrix of each subject as an unstructured matrix:

proc hpmixed;
   class sub;
   model y = x;
   random  time / sub=patient type=chol;
run;

The HPMIXED procedure constrains the diagonal elements of the Cholesky root to be positive. This guarantees that the structure is positive definite.

CS

specifies the compound-symmetry structure, which has constant variance and constant covariance

normal upper C normal o normal v left-bracket xi Subscript i Baseline comma xi Subscript j Baseline right-bracket equals StartLayout Enlarged left-brace 1st Row 1st Column sigma squared plus sigma 1 2nd Column i equals j 2nd Row 1st Column sigma 1 2nd Column i not-equals j EndLayout

Under compound-symmetry, the bold upper G matrix is of form sigma squared bold upper I plus sigma 1 bold upper J. The variance parameter sigma squared is constrained to be positive, and the covariance parameter sigma 1 is constrained to be greater than minus sigma squared slash t where t is the dimension of the structure. This guarantees the structure is positive definite. The compound-symmetry structure arises naturally with nested random effects, such as when a subsampling error is nested within an experimental error.

CSH

specifies the heterogeneous compound-symmetry structure. This structure has a different variance parameter for each diagonal element, and it uses the square roots of these parameters in the off-diagonal entries. In Table 7, sigma Subscript i Superscript 2 is the ith variance parameter that satisfies sigma Subscript i Superscript 2 Baseline greater-than 0, and rho is the correlation parameter that satisfies rho greater-than negative 1 slash left-parenthesis t minus 1 right-parenthesis, where t is the dimension of the structure. This guarantees that the structure is positive definite.

TOEP(1)

specifies a Toeplitz structure with one band. It is the same as sigma squared upper I, where I is an identity matrix, and it can be useful for specifying the same variance component for several effects.

UC

specifies the uniform correlation structure, which has constant variance and constant correlation

normal upper C normal o normal v left-bracket xi Subscript i Baseline comma xi Subscript j Baseline right-bracket equals StartLayout Enlarged left-brace 1st Row 1st Column sigma squared 2nd Column i equals j 2nd Row 1st Column sigma squared rho 2nd Column i not-equals j EndLayout

Under uniform correlation, the bold upper G matrix is of form sigma squared left-bracket left-parenthesis 1 minus rho right-parenthesis bold upper I plus rho bold upper J right-bracket. The variance sigma squared is constrained to be positive, and the correlation rho is constrained to be greater than negative 1 slash left-parenthesis t minus 1 right-parenthesis, where t is the dimension of the structure. This guarantees the structure is positive definite. This structure is equivalent to the compound-symmetry structure with a better numerical property in terms of optimization.

The uniform correlation structure arises frequently in agriculture and animal sciences.

UCH

specifies the heterogeneous uniform correlation structure. This structure has a different variance parameter for each diagonal element, and it uses the square roots of these parameters in the off-diagonal entries. In Table 7, sigma Subscript i Superscript 2 is the ith variance parameter that satisfies sigma Subscript i Superscript 2 Baseline greater-than 0, and rho is the correlation parameter that satisfies rho greater-than negative 1 slash left-parenthesis t minus 1 right-parenthesis, where t is the dimension of the structure. This guarantees that the structure is positive definite.

UN

specifies a completely general (unstructured) covariance matrix parameterized directly in terms of variances and covariances. The variances are constrained to be positive, and the covariances are unconstrained. In addition, this structure is internally constrained to be positive definite.

VC

specifies standard variance components and is the default structure for the RANDOM and REPEATED statements. In the RANDOM statement, a distinct variance component is assigned to each effect. In the REPEATED statement, this structure is usually used only with the GROUP= option to specify a heterogeneous variance model.

Last updated: December 09, 2022