简体   繁体   English

如何在 R 中创建部分因子设计?

[英]How to create a fractional factorial design in R?

I'm struggling to create a rather elaborate fractional factorial design using R.我正在努力使用 R 创建一个相当复杂的部分因子设计。

(see http://en.wikipedia.org/wiki/Fractional_factorial_design ) (见http://en.wikipedia.org/wiki/Fractional_factorial_design

I've searched the Google and the R-lists and have checked out several promising packages (AlgDesign, DoE.base, acepack)我搜索了 Google 和 R-lists,并检查了几个有前途的软件包(AlgDesign、DoE.base、acepack)

But I have not found anything thing that can handle a fractional design (only interested in main effects) with 8 factors that have either 3, 4, 6, or 11 levels each!但是我没有发现任何东西可以处理具有 8 个因子的部分设计(仅对主效应感兴趣),每个因子具有 3、4、6 或 11 个级别!

Can anyone point me in the right direction?任何人都可以指出我正确的方向吗?

Thanks!谢谢!

I have used the package AlgDesign to generate fractional factorial designs:我使用包AlgDesign生成部分因子设计:

  1. Generate the full factorial design using the function gen.factorial() .使用函数gen.factorial()生成全因子设计。
  2. Pass the results to optFederov() - this will try to find an optimum fractional design, using the Federov algorithm.将结果传递给optFederov() - 这将尝试使用 Federov 算法找到最佳分数设计。

The following code takes about 3 minutes to run on my Windows laptop.以下代码在我的 Windows 笔记本电脑上运行大约需要 3 分钟。 The example finds an approximate optimum fractional factorial design with 8 factors with 3, 4, 6 or 11 levels each, as you specified.该示例根据您的指定,找到一个近似最优的部分因子设计,其中包含 8 个因子,每个因子具有 3、4、6 或 11 个水平。

Note that I use optFederov(..., approximate=TRUE) - this finds an approximate solution.请注意,我使用optFederov(..., approximate=TRUE) - 这找到了一个近似解。 On my machine, when I set approximate=FALSE the code takes too long to run and Windows throws a strop.在我的机器上,当我设置approximate=FALSE ,代码运行时间过长,Windows 会抛出一个strop。 You may wish to experiment with 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 the 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

Just to add to Andrie's answer.只是为了补充安德里的答案。 This is how we interpret strength of optimual design.这就是我们如何解释优化设计的强度。

Design efficiency is judged by Ge.设计效率由Ge来判断。 It should be 1 or close to 1. Below links have some explanation and i referred the book "Design and Analysis of Experiments with R".它应该是 1 或接近 1。下面的链接有一些解释,我参考了“用 R 进行实验的设计和分析”一书。 Thought this might be useful for those who are looking for answer.认为这可能对那些正在寻找答案的人有用。 Below are the source from which i got this information.以下是我获得此信息的来源。

https://stat.ethz.ch/pipermail/r-help/2007-October/143217.html https://stat.ethz.ch/pipermail/r-help/2007-October/143217.html

Error in Hierarchical Bayesn in R : Bayesn Package R中的分层贝叶斯错误:贝叶斯包

The D, A, I, G-optimal designs are all bounded designs(the designs are on the bounds of design space), I don't think the optimal design results are good at fitting response surface or surrogate model. D、A、I、G的优化设计都是有界设计(设计在设计空间的边界上),我认为优化设计的结果不太适合拟合响应面或代理模型。 Meanwhile, the optimal design is usually not orthogonal.同时,优化设计通常不是正交的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM