RANDOM Subcommand (MIXED command)

The RANDOM subcommand specifies the random effects in the mixed model.

  • Depending on the covariance type specified, random effects specified in one RANDOM subcommand may be correlated.
  • One covariance G matrix will be constructed for each RANDOM subcommand. The dimension of the random effect covariance G matrix is equal to the sum of the levels of all random effects in the subcommand.
  • When the variance components (VC) structure is specified, a scaled identity (ID) structure will be assigned to each of the effects specified. This is the default covariance type for the RANDOM subcommand.
  • Note that the RANDOM subcommand in the MIXED procedure is different in syntax from the RANDOM subcommand in the GLM and VARCOMP procedures.
  • Use a separate RANDOM subcommand when a different covariance structure is assumed for a list of random effects. If the same effect is listed on more than one RANDOM subcommand, it must be associated with a different SUBJECT combination.
  • Specify a list of terms to be included in the model, separated by commas or spaces.
  • No random effects are included in the mixed model unless a RANDOM subcommand is specified correctly.
  • Specify the keyword INTERCEPT to include the intercept as a random effect. The MIXED procedure does not include the intercept in the RANDOM subcommand by default. The INTERCEPT term must be specified first on the RANDOM subcommand.
  • To include a main-effect term, enter the name of the factor on the RANDOM subcommand.
  • To include an interaction-effect term among factors, use the keyword BY or the asterisk (*) to join factors involved in the interaction. For example, A*B*C means a three-way interaction effect of A, B, and C, where A, B, and C are factors. The expression A BY B BY C is equivalent to A*B*C. Factors inside an interaction effect must be distinct. Expressions such as A*C*A and A*A are invalid.
  • To include a nested-effect term, use the keyword WITHIN or a pair of parentheses on the RANDOM subcommand. For example, A(B) means that A is nested within B, where A and B are factors. The expression A WITHIN B is equivalent to A(B). Factors inside a nested effect must be distinct. Expressions such as A(A) and A(B*A) are invalid.
  • Multiple-level nesting is supported. For example, A(B(C)) means that B is nested within C, and A is nested within B(C). When more than one pair of parentheses is present, each pair of parentheses must be enclosed or nested within another pair of parentheses. Thus, A(B)(C) is invalid.
  • Nesting within an interaction effect is valid. For example, A(B*C) means that A is nested within B*C.
  • Interactions among nested effects are allowed. The correct syntax is the interaction followed by the common nested effect inside the parentheses. For example, the interaction between A and B within levels of C should be specified as A*B(C) instead of A(C)*B(C).
  • To include a covariate term in the model, enter the name of the covariate on the FIXED subcommand.
  • Covariates can be connected using the keyword BY or the asterisk (*). For example, X*X is the product of X and itself. This is equivalent to entering a covariate whose values are the squared values of X.
  • Factor and covariate effects can be connected in many ways. Suppose that A and B are factors and X and Y are covariates. Examples of valid combinations of factor and covariate effects are A*X, A*B*X, X(A), X(A*B), X*A(B), X*Y(A*B), and A*B*X*Y.
  • No effects can be nested within a covariate effect. Suppose that A and B are factors and X and Y are covariates. The effects A(X), A(B*Y), X(Y), and X(B*Y) are invalid.
  • The following options, which are specific for the random effects, can be entered after the effects. Use the vertical bar (|) to precede the options.

    SUBJECT(varname*varname*… ). Identify the subjects. Complete independence is assumed across subjects, thus producing a block-diagonal structure in the covariance matrix of the random effect with identical blocks. Specify a list of variable names (of any type) connected by asterisks. The number of subjects is equal to the number of distinct combinations of values of the variables. A case will not be used if it contains a missing value on any of the subject variables.

    COVTYPE(type). Covariance structure. Specify the covariance structure of the identical blocks for the random effects (see Covariance Structure List (MIXED command)). The default covariance structure for random effects is VC.

  • If the REPEATED subcommand is specified, the variables in the RANDOM subject list must be a subset of the variables in the REPEATED subject list.
  • Random effects are considered independent of each other, and a separate covariance matrix is computed for each effect.

Example

MIXED  SCORE BY SCHOOL CLASS
  /RANDOM = INTERCEPT SCHOOL CLASS.