a <- buildfactor(jsub, dims), integer jsub > 0, dims a vector of positive integers, length(dims) >= jsub |

fac_j <- buildfactor(j, dims) creates a factor corresponding to the values of subscript j for a balanced factorial design. dims must be a vector of positive integers and j must be a positive integer <= k = length(dims). fac_j will be a factor with dims[j] levels, with length(fac_j) = prod(dims), the product of the elements of dims. fac_j may be used in an ANOVA of a factorial experiment where each case is identified by k subscripts with the first changing fastest and the last changing slowest, with subscript i running from 1 to dims[i]. Example: Cmd> dims <- vector(2,3,2) Cmd> fac_1 <- buildfactor(1,dims) Cmd> fac_2 <- buildfactor(2,dims) Cmd> fac_3 <- buildfactor(3,dims) Cmd> list(fac_1,fac_2,fac_3) fac_1 REAL 12 FACTOR with 2 levels fac_2 REAL 12 FACTOR with 3 levels fac_3 REAL 12 FACTOR with 2 levels Cmd> print(fac_1,fac_2,fac_3,format:"2.0f") fac_1: (1) 1 2 1 2 1 2 1 2 1 2 1 2 fac_2: (1) 1 1 2 2 3 3 1 1 2 2 3 3 fac_3: (1) 1 1 1 1 1 1 2 2 2 2 2 2 These factors could be used in analysis of a single replicate of a 2 by 3 by 2 design in standard order, say by anova("y=fac_1+fac_2+fac_3"). See also factor(), makefactor(), rep()

Gary Oehlert 2003-01-15