Se estudia la conversión (%) de una esterificación en función de la concentración de catalizador (1.0–2.0 % p/p) y la temperatura (120–140 °C). Se corrió un \(2^2\) con 4 puntos centrales.
library(rsm)
## Warning: package 'rsm' was built under R version 4.6.2
p1 <- data.frame(
Cat = c(1.0, 2.0, 1.0, 2.0, 1.5, 1.5, 1.5, 1.5),
Temp = c(120, 120, 140, 140, 130, 130, 130, 130),
Conv = c(54.2, 58.1, 57.0, 62.3, 57.9, 58.4, 57.6, 58.2)
)
p1
## Cat Temp Conv
## 1 1.0 120 54.2
## 2 2.0 120 58.1
## 3 1.0 140 57.0
## 4 2.0 140 62.3
## 5 1.5 130 57.9
## 6 1.5 130 58.4
## 7 1.5 130 57.6
## 8 1.5 130 58.2
p1c <- coded.data(p1,
x1 ~ (Cat - 1.5) / 0.5,
x2 ~ (Temp - 130) / 10)
p1c
## Cat Temp Conv
## 1 1.0 120 54.2
## 2 2.0 120 58.1
## 3 1.0 140 57.0
## 4 2.0 140 62.3
## 5 1.5 130 57.9
## 6 1.5 130 58.4
## 7 1.5 130 57.6
## 8 1.5 130 58.2
##
## Data are stored in coded form using these coding formulas ...
## x1 ~ (Cat - 1.5)/0.5
## x2 ~ (Temp - 130)/10
m1 <- rsm(Conv ~ FO(x1, x2), data = p1c)
summary(m1)
##
## Call:
## rsm(formula = Conv ~ FO(x1, x2), data = p1c)
##
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 57.96250 0.14906 388.8547 2.135e-12 ***
## x1 2.30000 0.21080 10.9107 0.0001124 ***
## x2 1.75000 0.21080 8.3016 0.0004142 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Multiple R-squared: 0.9741, Adjusted R-squared: 0.9637
## F-statistic: 93.98 on 2 and 5 DF, p-value: 0.0001081
##
## Analysis of Variance Table
##
## Response: Conv
## Df Sum Sq Mean Sq F value Pr(>F)
## FO(x1, x2) 2 33.410 16.7050 93.9803 0.0001081
## Residuals 5 0.889 0.1777
## Lack of fit 2 0.521 0.2606 2.1276 0.2658989
## Pure error 3 0.367 0.1225
##
## Direction of steepest ascent (at radius 1):
## x1 x2
## 0.7958287 0.6055218
##
## Corresponding increment in original units:
## Cat Temp
## 0.3979143 6.0552183
m1b <- rsm(Conv ~ FO(x1, x2) + TWI(x1, x2), data = p1c)
summary(m1b)$coefficients
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 57.9625 0.1116286 519.244315 8.253792e-11
## x1 2.3000 0.1578666 14.569260 1.290871e-04
## x2 1.7500 0.1578666 11.085306 3.766683e-04
## x1:x2 0.3500 0.1578666 2.217061 9.090890e-02
st <- steepest(m1, dist = seq(0, 12, by = 2))
## Path of steepest ascent from ridge analysis:
st
## dist x1 x2 | Cat Temp | yhat
## 1 0 0.000 0.000 | 1.5000 130.00 | 57.962
## 2 2 1.592 1.211 | 2.2960 142.11 | 63.743
## 3 4 3.183 2.422 | 3.0915 154.22 | 69.522
## 4 6 4.775 3.633 | 3.8875 166.33 | 75.303
## 5 8 6.366 4.843 | 4.6830 178.43 | 81.080
## 6 10 7.959 6.056 | 5.4795 190.56 | 86.866
## 7 12 9.551 7.267 | 6.2755 202.67 | 92.647
tray <- as.data.frame(st)
tray$Cat <- 1.5 + 0.5 * tray$x1
tray$Temp <- 130 + 10 * tray$x2
tray$y_pred <- predict(m1, newdata = st)
round(tray[, c("x1", "x2", "Cat", "Temp", "y_pred")], 2)
## x1 x2 Cat Temp y_pred
## 1 0.00 0.00 1.50 130.00 57.96
## 2 1.59 1.21 2.30 142.11 63.74
## 3 3.18 2.42 3.09 154.22 69.52
## 4 4.78 3.63 3.89 166.33 75.30
## 5 6.37 4.84 4.68 178.43 81.08
## 6 7.96 6.06 5.48 190.56 86.87
## 7 9.55 7.27 6.28 202.67 92.65
plot(tray$x1, tray$y_pred,
type = "b",
pch = 19,
col = "#ff4567",
xlab = "Paso de ascenso (unidades codificadas)",
ylab = "Conversión predicha (%)",
main = "Trayectoria de ascenso más pronunciado")