statistics - How to create a fractional factorial design in R? -
i'm struggling create rather elaborate fractional factorial design using r.
(see http://en.wikipedia.org/wiki/fractional_factorial_design)
i've searched google , r-lists , have checked out several promising packages (algdesign, doe.base, acepack)
but have not found thing can handle fractional design (only interested in main effects) 8 factors have either 3, 4, 6, or 11 levels each!
can point me in right direction?
thanks!
i have used package algdesign
generate fractional factorial designs:
- generate full factorial design using function
gen.factorial()
. - pass results
optfederov()
- try find optimum fractional design, using federov algorithm.
the following code takes 3 minutes run on windows laptop. example finds approximate optimum fractional factorial design 8 factors 3, 4, 6 or 11 levels each, specified.
note use optfederov(..., approximate=true)
- finds approximate solution. on machine, when set approximate=false
code takes long run , windows throws strop. may wish experiment different settings.
library(algdesign) levels.design = c(3,4,6,11,3,4,6,11) f.design <- gen.factorial(levels.design) fract.design <- optfederov( data=f.design, ntrials=sum(levels.design), approximate=true)
and output:
head(f.design) x1 x2 x3 x4 x5 x6 x7 x8 1 -1 -3 -5 -5 -1 -3 -5 -5 2 0 -3 -5 -5 -1 -3 -5 -5 3 1 -3 -5 -5 -1 -3 -5 -5 4 -1 -1 -5 -5 -1 -3 -5 -5 5 0 -1 -5 -5 -1 -3 -5 -5 6 1 -1 -5 -5 -1 -3 -5 -5 fract.design $d [1] 6.813321 $a [1] 0.375804 $ge [1] 0.998 $dea [1] 0.998 $design rep.. x1 x2 x3 x4 x5 x6 x7 x8 1 1 -1 -3 -5 -5 -1 -3 -5 -5 10 1 -1 3 -5 -5 -1 -3 -5 -5 ... 626475 1 1 -3 -5 -5 1 3 5 5 627253 1 -1 -3 5 5 1 3 5 5 $rows [1] 1 10 61 723 790 1596 2307 2314 2365 2374 [11] 2376 7129 7140 7198 7849 7911 7918 7920 8713 8724 [21] 9433 9504 48252 48301 48303 49105 49107 49114 49174 54660 [31] 54711 56233 56304 570241 570963 571834 571836 572556 578151 579015 [41] 617821 617823 619414 620127 620134 625618 626475 627253
Comments
Post a Comment