Next: padto() Up: MacAnova Help File Previous: options   Contents

outer()

Usage:
 ```outer(x1, x2, ...), x1, x2, ... REAL ```

Keywords: matrix algebra
```outer(x1, x2) returns a matrix or array which is the "outer product" of
REAL variables x1 and x2.  The dimensions of the result are the
joined dimensions of the arguments.

After result <- outer(x1,x2), the elements of the result are
result[i,j,k,...,l,m,n,...] = x1[i,j,k,...] * x2[l,m,n,...].

outer(x1, x2) is equivalent to array(vector(x1)*vector(x2)',
vector(dim(x1), dim(x2))).

outer(x1, x2, x3) is mathematically equivalent to outer(outer(x1,x2),
x3) and in general outer(x1, x2, x3, ..., xk) is mathematically
equivalent to outer(outer(...(outer(x1,x2), x3), ...), xk).  The
elements of the result are all possible k-way products of elements from
each of the arguments.

One use for outer() is to construct multidimensional contrasts that are
products of 1 dimensional contrasts.  Suppose c1, c2 and c3 are vectors
of main effect contrast coefficients for each factor for a 3 factor
design.  Then after anova("y=a*b*c"),

Cmd> contrast("a.b.c", outer(c1,c2,c3))

computes results for the three way product contrast that is part of the
a.b.c interaction.

See also topics contrast(), array(), 'matrices'
```

Gary Oehlert 2003-01-15