Next: confound2() Up: Design Macros Help File Previous: choosedef2()   Contents

# choosegen2()

Usage:
 ```choosegen2(k,p, all:T [,res:r]), positive integers k, p, r. choosegen2(k,p, tries:m [,res:r]), positive integers k, p, m, and r. ```

Keywords: aliasing, design, factorial
```choosegen2(k,p,all:T) , where k, p and r are positive integers, searches
all potential sets of generators for a 2^(k-p) fractional factorial
design.  It returns information on a generator with maximum resolution.

choosegen2(k,p, tries:m), where m > 0 is an integer, does the same,
except it searches only m randomly selected sets of generators.

choosegen2(k,p,all:T,res:r) and choosegen2(k,p,tries:m,res:r), where r
is a positive integer, do the same, except they stop the search at the
first design of resolution r.  If none is found, they return information
on a set having the highest resolution found.

The value returned is
structure(resolution:bestres,generators:bestgen,aberration:aber,\
basis:genmat)

Integer bestres > 0 is the best resolution found.

bestgen is a CHARACTER vector of length p with the names such as "ABDF"
of the defining contrasts in the set chosen.

aber is a vector of k integers >= 0 with ab[i] containing the number
of contrast with i letters that are confounded with "I".

genmat is a p by k matrix with entries 0 and 1, one row for each element
of bestgen.  genmat[i,j] is 1 if and only if factor j is bestgen[i].
For example, if bestgen[i] is "ABDF", genmat[i,] is vector(1,1,0,1,0,1
[,...])'.  genmat can be used as an argument to aliases2() to determine
all the aliases of any contrast.

Examples:
Cmd> choosegen2(5,2,all:T)  # find best resolution
component: resolution
(1)           3
component: generators
(1) "ABCD"
(2) "BCE"
component: aberration
(1)           0           0           2           1           0
component: basis
(1,1)           1           1           1           1           0
(2,1)           0           1           1           0           1

Cmd> choosegen2(5,2,all:T,res:4)  # try to find 4 (we won't)
component: resolution
(1)           3
component: generators
(1) "ABCD"
(2) "BCE"
component: aberration
(1)           0           0           2           1           0
component: basis
(1,1)           1           1           1           1           0
(2,1)           0           1           1           0           1

Cmd> # look for 2^(9-4) resol. 4, just make 1000 tries, since\
there are lots of combinations to explore

Cmd> choosegen2(9,4,tries:1000,res:4)# look for 2^(9-4) resol. 4
component: resolution
(1)           4
component: generators
(1) "CDEF"
(2) "BDEG"
(3) "ABCEH"
(4) "BCDJ"
component: aberration
(1)           0           0           0           7           7
(6)           0           0           0           1
component: basis
(1,1)           0           0           1           1           1
(1,6)           1           0           0           0
(2,1)           0           1           0           1           1
(2,6)           0           1           0           0
(3,1)           1           1           1           0           1
(3,6)           0           0           1           0
(4,1)           0           1           1           1           0
(4,6)           0           0           0           1