我希望rsm
获取Block
对象的每个等级的library(rsm)
CR <- coded.data (ChemReact, x1~(Time-85)/5, x2~(Temp-175)/5)
CR.rs2 <- rsm (Yield ~ Block + SO(x1,x2), data=CR)
summary(CR.rs2)
persp(
CR.rs2
, x1 ~ x2
, col = rainbow(50)
, ticktype = "simple"
, contour = ("colors")
)
contour(CR.rs2, ~ x1 + x2, image = TRUE, at = summary(CR.rs2)$canonical$xs)
对象的轮廓和透视图。如果有人在这方面帮助我,我将非常感激。感谢
{{1}}
期望的输出
轮廓图
透视图
答案 0 :(得分:1)
只需在at
参数中包含该块:
contour(CR.rs2, ~ x1 + x2, image = TRUE,
at = c(summary(CR.rs2)$canonical$xs, Block="B1"))
contour(CR.rs2, ~ x1 + x2, image = TRUE,
at = c(summary(CR.rs2)$canonical$xs, Block="B2"))
...与persp
答案 1 :(得分:0)
persp.lm中为persp部分设置数据的行是:
plot.data = contour.lm(x, form, at, bounds, zlim, xlabs,
atpos = atpos, plot.it = FALSE)
在contour.lm中查看plot.data的构造,你可以看到它是一个列表:
plot.data[[i]] = list(x = x, y = y, z = matrix(z, nrow = length(x)),
labs = labs)
比较contour.lm的输出和origianl模型中的系数,您可以看到绘制的内容(最大值为82)是平均响应面(因为截距为84.095,块效应为-4.458。因此,请输出形式contour.lm并使用它来绘制经过适当调整的estiamtes作为单独的效果:
> plt <- contour.lm(CR.rs2, x1 ~ x2, plot.it=FALSE)
> names(plt)
[1] "x2 ~ x1"
> str(plt)
List of 1
$ x2 ~ x1:List of 5
..$ x : num [1:26] 168 168 169 170 170 ...
..$ y : num [1:26] 77.9 78.5 79.1 79.6 80.2 ...
..$ z : num [1:26, 1:26] 75.5 75.8 76.1 76.4 76.7 ...
..$ labs: Named chr [1:5] "Temp" "Time" "x2" "x1" ...
.. ..- attr(*, "names")= chr [1:5] "x2" "x1" "x" "y" ...
..$ zlim: num [1:2] 75.5 82.1