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
RANDOMsubcommand may be correlated. - One covariance G matrix will be constructed for each
RANDOMsubcommand. 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 theRANDOMsubcommand. - Note that the
RANDOMsubcommand in theMIXEDprocedure is different in syntax from theRANDOMsubcommand in theGLMandVARCOMPprocedures. - Use a separate
RANDOMsubcommand when a different covariance structure is assumed for a list of random effects. If the same effect is listed on more than oneRANDOMsubcommand, it must be associated with a differentSUBJECTcombination. - 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
RANDOMsubcommand is specified correctly. - Specify the keyword
INTERCEPTto include the intercept as a random effect. TheMIXEDprocedure does not include the intercept in theRANDOMsubcommand by default. TheINTERCEPTterm must be specified first on theRANDOMsubcommand. - To include a main-effect term, enter the name of
the factor on the
RANDOMsubcommand. - To include an interaction-effect term among factors,
use the keyword
BYor the asterisk (*) to join factors involved in the interaction. For example,A*B*Cmeans a three-way interaction effect of A, B, and C, where A, B, and C are factors. The expressionA BY B BY Cis equivalent toA*B*C. Factors inside an interaction effect must be distinct. Expressions such asA*C*AandA*Aare invalid. - To include a nested-effect term, use the keyword
WITHINor a pair of parentheses on theRANDOMsubcommand. For example,A(B)means that A is nested within B, where A and B are factors. The expressionA WITHIN Bis equivalent toA(B). Factors inside a nested effect must be distinct. Expressions such asA(A)andA(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 ofA(C)*B(C). - To include a covariate term in the model, enter the
name of the covariate on the
FIXEDsubcommand. - Covariates can be connected using the keyword
BYor the asterisk (*). For example,X*Xis 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), andA*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), andX(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.SOLUTION. Specifies to display the random-effects parameter estimates.
- If the
REPEATEDsubcommand is specified, the variables in theRANDOMsubject list must be a subset of the variables in theREPEATEDsubject 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.