Next: pairwise() Up: Design Macros Help File Previous: interblock()   Contents

mixed()

Usage:
mixed(Model,randomvars[,marg:T] [,restrict:F] [,nonhier:T] [,useneg:T]\
  [,keepmixed:T]), CHARACTER scalar model, CHARACTER vector randomvars
mixed(emsResult [,useneg:T] [,keepmixed:T]), emsResult a structure
  returned by ems() with keep:T



Keywords: anova, analysis, random effects, factorial
                                  Usage
mixed(Model, randomvars) computes and prints an "ANOVA" table
appropriate for the model and random factors given in CHARACTER scalar
Model and CHARACTER vector randomvars.  These arguments are exactly the
same as for ems().  You can also use ems() keywords 'marg', 'restrict'
and 'nonhier'.

mixed(emsResult), where emsResult has been computed by emsResult <-
ems(Model, randomvars [,...],keep:T), does the same.

mixed(Model, randvars [,...], keepmixed:T) returns the table as an
matrix with appropriately labelled rows and columns but does not print
it.

The anova table has one row for each term in the model and the following
seven columns.
  Col. 1   Label for term
  Col. 2   DF = degrees of freedom for term
  Col. 3   MS = mean square for term (numerator of F)
  Col. 4   Error DF = degrees of freedom for appropriate error term
  Col. 5   Error MS = mean square for appropriate error term
           (denominator of F)
  Col. 6   F = F-statistic = MS/(Error MS)
  Col. 7   P value = tail probability for F test

With keepmixed:T, the matrix returned consists of columns 2 through 7 of
the table, with column 1 used to label rows.

               Description of numerator and denominator MS
Numerator and denominator MS's are linear combinations of mean squares
whose expectations differ only by a multiple of the variance component
associated with the line.  When the numerator or denominator is not a
simple ANOVA mean square, its degrees of freedom are found using the
Satterthwaite approximation.

By default, only linear combinations of mean squares with positive
coefficients are used.  This means that the numerator for a term may be
the sum of the mean square for the term and one or more mean squares
from other terms.  If the keyword useneg:T is used, then the numerator
for a term will be the mean square for that term, and denominators may
contain differences as well as sums of mean squares.

Example:
Three populations, all crosses between 4 males and 4 females in each
population with six offspring from each mating randomly assigned to
three environments.  Male and female are random.  First the simple
ANOVA.

  Cmd> anova("y=(pop+m.pop+f.pop+m.f.pop)*env")
  Model used is y=(pop+m.pop+f.pop+m.f.pop)*env
                  DF           SS           MS
  CONSTANT         1       5.4299       5.4299
  pop              2       2091.4       1045.7
  pop.m            9        112.5         12.5
  pop.f            9       370.02       41.113
  pop.m.f         27       56.774       2.1027
  env              2       206.15       103.08
  pop.env          4      0.16527     0.041316
  pop.m.env       18       3.4185      0.18992
  pop.f.env       18       8.2354      0.45752
  pop.m.f.env     54       17.117      0.31698
  ERROR1         144       30.448      0.21144

Now compute the expected mean squares, and keep the ems() output.

  Cmd> emsstuff<-ems("y=(pop+m.pop+f.pop+m.f.pop)*env",vector("m","f"),
     keep:T,print:T)
  EMS(CONSTANT) = V(ERROR1) + 6V(pop.m.f) + 24V(pop.f) + 24V(pop.m) +
     288Q(CONSTANT)
  EMS(pop) = V(ERROR1) + 6V(pop.m.f) + 24V(pop.f) + 24V(pop.m) + 96Q(pop)
  EMS(pop.m) = V(ERROR1) + 6V(pop.m.f) + 24V(pop.m)
  EMS(pop.f) = V(ERROR1) + 6V(pop.m.f) + 24V(pop.f)
  EMS(pop.m.f) = V(ERROR1) + 6V(pop.m.f)
  EMS(env) = V(ERROR1) + 2V(pop.m.f.env) + 8V(pop.f.env) +
     8V(pop.m.env) + 96Q(env)
  EMS(pop.env) = V(ERROR1) + 2V(pop.m.f.env) + 8V(pop.f.env) +
     8V(pop.m.env) + 32Q(pop.env)
  EMS(pop.m.env) = V(ERROR1) + 2V(pop.m.f.env) + 8V(pop.m.env)
  EMS(pop.f.env) = V(ERROR1) + 2V(pop.m.f.env) + 8V(pop.f.env)
  EMS(pop.m.f.env) = V(ERROR1) + 2V(pop.m.f.env)
  EMS(ERROR1) = V(ERROR1)

Now use mixed().

  Cmd> mixed(emsstuff)
                  DF        MS  Error DF  Error MS         F    P value
  CONSTANT     1.914     7.533     14.01     53.61    0.1405     0.8617
  pop          2.008      1048     14.01     53.61     19.54  8.745e-05
  pop.m            9      12.5        27     2.103     5.945  0.0001412
  pop.f            9     41.11        27     2.103     19.55  1.242e-09
  pop.m.f         27     2.103       144    0.2114     9.945          0
  env          2.012     103.4     30.75    0.6474     159.7          0
  pop.env      56.12    0.3583     30.75    0.6474    0.5534     0.9729
  pop.m.env       18    0.1899        54     0.317    0.5991     0.8844
  pop.f.env       18    0.4575        54     0.317     1.443     0.1496
  pop.m.f.env     54     0.317       144    0.2114     1.499    0.03044
  ERROR1         144    0.2114         0         0   MISSING    MISSING

The test for environment should be
(MS(env)+MS(m.f.env))/(MS(m.env)+MS(f.env)) = (103.08+.32)/(.190+.458) =
(103.4)/(.6474) = 159.7 as reported in the table.

                            Cross references
See also ems(), reml().


Gary Oehlert 2005-08-12