0% found this document useful (0 votes)
21 views

ch4 4试验设计与数据分析-最速上升法

Uploaded by

cab01627
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

ch4 4试验设计与数据分析-最速上升法

Uploaded by

cab01627
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

试验设计与数据分析

最速下降(上升)法
[email protected] (mailto:[email protected])
2022.04.16

适用场景:
最速下降(上升)法(steepest descent(ascent) algorithm)
用于探索响应面设计的中心点。
避免响应面设计无最优解。

例题,一位化学工程师要确定使过程产率最高的操作条件.影响产率的两个可控变量是反应时间和反应温度工程
师当前使用的操作条件是反应时间为35分钟,温度为155下,产率约为40%,因为此区域不大可能包含最优于是
她拟合一阶模型并应用最速上升法。
l i b r a r y (rsm)
cube.design <- rsm::cube(2, n0=5,
coding =list(x1~(time-35)/5, x2~(temperature-155)/5),
randomize = F)
cube.design$res <- c(39.3,40.9,40,41.5,40.3,40.5,40.7,40.2,40.6)
cube.design

## run.order std.order time temperature res


## 1 1 1 30 150 39.3
## 2 2 2 40 150 40.9
## 3 3 3 30 160 40.0
## 4 4 4 40 160 41.5
## 5 5 5 35 155 40.3
## 6 6 6 35 155 40.5
## 7 7 7 35 155 40.7
## 8 8 8 35 155 40.2
## 9 9 9 35 155 40.6
##
## Data are stored in coded form using these coding formulas ...
## x1 ~ (time - 35)/5
## x2 ~ (temperature - 155)/5

FO.model <- rsm(res~FO(x1,x2),data = cube.design)


summary(FO.model)
##
## Call:
## rsm(formula = res ~ FO(x1, x2), data = cube.design)
##
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 40.444444 0.057288 705.9869 5.451e-16 ***
## x1 0.775000 0.085932 9.0188 0.000104 ***
## x2 0.325000 0.085932 3.7821 0.009158 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Multiple R-squared: 0.941, Adjusted R-squared: 0.9213
## F-statistic: 47.82 on 2 and 6 DF, p-value: 0.0002057
##
## Analysis of Variance Table
##
## Response: res
## Df Sum Sq Mean Sq F value Pr(>F)
## FO(x1, x2) 2 2.82500 1.41250 47.8213 0.0002057
## Residuals 6 0.17722 0.02954
## Lack of fit 2 0.00522 0.00261 0.0607 0.9419341
## Pure error 4 0.17200 0.04300
##
## Direction of steepest ascent (at radius 1):
## x1 x2
## 0.9221944 0.3867267
##
## Corresponding increment in original units:
## time temperature
## 4.610972 1.933633

contour(FO.model, ~ x1 + x2, image = TRUE)


persp(FO.model, x2 ~ x1, zlab = "res")
FOTWI.model <- rsm(res~FO(x1,x2)+TWI(x1,x2),data = cube.design)
summary(FOTWI.model)

##
## Call:
## rsm(formula = res ~ FO(x1, x2) + TWI(x1, x2), data = cube.design)
##
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 40.444444 0.062311 649.0693 1.648e-13 ***
## x1 0.775000 0.093467 8.2917 0.0004166 ***
## x2 0.325000 0.093467 3.4772 0.0177127 *
## x1:x2 -0.025000 0.093467 -0.2675 0.7997870
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Multiple R-squared: 0.9418, Adjusted R-squared: 0.9069
## F-statistic: 26.97 on 3 and 5 DF, p-value: 0.00163
##
## Analysis of Variance Table
##
## Response: res
## Df Sum Sq Mean Sq F value Pr(>F)
## FO(x1, x2) 2 2.82500 1.41250 40.4213 0.0008188
## TWI(x1, x2) 1 0.00250 0.00250 0.0715 0.7997870
## Residuals 5 0.17472 0.03494
## Lack of fit 1 0.00272 0.00272 0.0633 0.8137408
## Pure error 4 0.17200 0.04300
##
## Stationary point of response surface:
## x1 x2
## 13 31
##
## Stationary point in original units:
## time temperature
## 100 310
##
## Eigenanalysis:
## eigen() decomposition
## $values
## [1] 0.0125 -0.0125
##
## $vectors
## [,1] [,2]
## x1 -0.7071068 -0.7071068
## x2 0.7071068 -0.7071068

最速上升(下降)的方向
回归方程的斜率
k = 0.325/0.775 = 0.4193548
x1增加1个单位,x2增加0.4193548
单位圆方向
x1 = 0.9221944 , x2 = 0.3867267, 0.3867267/0.9221944 = 0.4193548
time = 4.610972, temperature = 1.933633

FO.steepest <- steepest(FO.model, dist = seq(0, 20, by = 1))

## Path of steepest ascent from ridge analysis:

FO.steepest

## dist x1 x2 | time temperature | yhat


## 1 0 0.000 0.000 | 35.000 155.000 | 40.444
## 2 1 0.922 0.387 | 39.610 156.935 | 41.285
## 3 2 1.844 0.773 | 44.220 158.865 | 42.125
## 4 3 2.766 1.160 | 48.830 160.800 | 42.965
## 5 4 3.689 1.547 | 53.445 162.735 | 43.806
## 6 5 4.611 1.934 | 58.055 164.670 | 44.647
## 7 6 5.534 2.321 | 62.670 166.605 | 45.488
## 8 7 6.456 2.707 | 67.280 168.535 | 46.328
## 9 8 7.377 3.094 | 71.885 170.470 | 47.167
## 10 9 8.302 3.482 | 76.510 172.410 | 48.010
## 11 10 9.222 3.867 | 81.110 174.335 | 48.848
## 12 11 10.139 4.252 | 85.695 176.260 | 49.684
## 13 12 11.069 4.642 | 90.345 178.210 | 50.532
## 14 13 11.987 5.027 | 94.935 180.135 | 51.368
## 15 14 12.913 5.415 | 99.565 182.075 | 52.212
## 16 15 13.844 5.806 | 104.220 184.030 | 53.060
## 17 16 14.767 6.192 | 108.835 185.960 | 53.901
## 18 17 15.685 6.578 | 113.425 187.890 | 54.738
## 19 18 16.604 6.963 | 118.020 189.815 | 55.576
## 20 19 17.523 7.348 | 122.615 191.740 | 56.413
## 21 20 18.444 7.735 | 127.220 193.675 | 57.252
cube.design <- rsm::cube(2,
n0=5,
coding =list(x1~(time-85)/5, x2~(temperature-175)/5),
randomize = F)
res <- c(76.5,78,77,79.5,79.9,80.3,80,79.7,79.8)
cube.design$res <- res
cube.design

## run.order std.order time temperature res


## 1 1 1 80 170 76.5
## 2 2 2 90 170 78.0
## 3 3 3 80 180 77.0
## 4 4 4 90 180 79.5
## 5 5 5 85 175 79.9
## 6 6 6 85 175 80.3
## 7 7 7 85 175 80.0
## 8 8 8 85 175 79.7
## 9 9 9 85 175 79.8
##
## Data are stored in coded form using these coding formulas ...
## x1 ~ (time - 85)/5
## x2 ~ (temperature - 175)/5

FO.model <- rsm(res~FO(x1,x2),data = cube.design)


summary(FO.model)
##
## Call:
## rsm(formula = res ~ FO(x1, x2), data = cube.design)
##
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 78.96667 0.45379 174.0156 2.43e-12 ***
## x1 1.00000 0.68069 1.4691 0.1922
## x2 0.50000 0.68069 0.7346 0.4903
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Multiple R-squared: 0.3102, Adjusted R-squared: 0.08023
## F-statistic: 1.349 on 2 and 6 DF, p-value: 0.3283
##
## Analysis of Variance Table
##
## Response: res
## Df Sum Sq Mean Sq F value Pr(>F)
## FO(x1, x2) 2 5.000 2.5000 1.3489 0.3282610
## Residuals 6 11.120 1.8533
## Lack of fit 2 10.908 5.4540 102.9057 0.0003635
## Pure error 4 0.212 0.0530
##
## Direction of steepest ascent (at radius 1):
## x1 x2
## 0.8944272 0.4472136
##
## Corresponding increment in original units:
## time temperature
## 4.472136 2.236068

练习
一位工程师开发双项存货系统的计算机模拟模型,决策变量是订货量(Order Quantity)和再订购点(Reorder
point)。需要最小化的响应是总存货成本(Total Cost)。识别出试验设计,并求最速上升路径。
cube.design <- rsm::cube(2,
n0=3,
reps = 2,
coding =list(x1~(Order-275)/25, x2~(Reorder-60)/20),
randomize = F)
res <- c(625,670,663,648,654,634,692,686,680,674,681)
cube.design$res <- res
cube.design

## run.order std.order Order Reorder res


## 1 1 1 250 40 625
## 1.1 2 2 250 40 670
## 2 3 3 300 40 663
## 2.1 4 4 300 40 648
## 3 5 5 250 80 654
## 3.1 6 6 250 80 634
## 4 7 7 300 80 692
## 4.1 8 8 300 80 686
## 11 9 9 275 60 680
## 21 10 10 275 60 674
## 31 11 11 275 60 681
##
## Data are stored in coded form using these coding formulas ...
## x1 ~ (Order - 275)/25
## x2 ~ (Reorder - 60)/20

FO.model <- rsm(res~FO(x1,x2),data = cube.design)


summary(FO.model)
##
## Call:
## rsm(formula = res ~ FO(x1, x2), data = cube.design)
##
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 664.2727 5.7125 116.2839 3.343e-14 ***
## x1 13.2500 6.6985 1.9781 0.0833 .
## x2 7.5000 6.6985 1.1197 0.2953
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Multiple R-squared: 0.3924, Adjusted R-squared: 0.2405
## F-statistic: 2.583 on 2 and 8 DF, p-value: 0.1363
##
## Analysis of Variance Table
##
## Response: res
## Df Sum Sq Mean Sq F value Pr(>F)
## FO(x1, x2) 2 1854.5 927.25 2.5832 0.1363
## Residuals 8 2871.7 358.96
## Lack of fit 2 1500.0 750.01 3.2807 0.1090
## Pure error 6 1371.7 228.61
##
## Direction of steepest ascent (at radius 1):
## x1 x2
## 0.8702569 0.4925982
##
## Corresponding increment in original units:
## Order Reorder
## 21.756421 9.851964

You might also like