I am a new user of R, mostly interested in the RSM package. I'm really kindly thanking in advance whoever would like to help on this one, which is becaming a little bit frustrating.
I have generated an RSM model from a dataset (which I attach here in a shortened version, as an image):
library(rsm)
remove(list = ls())
setwd(" ... ")
dataf= read.csv("DATASET_ex.csv")
x1 <- dataf$alfa
x2 <- dataf$ER
x3 <- dataf$Temp
y = dataf$Speed
y_model <- rsm(y ~ SO(x1,x2,x3), data=dataf)
summary(y_model)
...but surface plots simply do not work (no matter if I use the x1,x2,x3 notation or the "real" variable names or any combination of them):
par(mfrow = c(1,3))
contour(y_model, ~ alfa+ER+Temp)
par(mfrow = c(1,3))
contour(y_model, ~ dataf$alfa+dataf$ER+dataf$Temp)
par(mfrow=c(1,3))
contour(y_model, ~x1+x2+x3, image=TRUE, at=summary(y_model$canonical$xs))
I keep facing errors like: "Error in [.data.frame
(dat, , vars, drop = FALSE) :
undefined columns selected".
Eventually, my final goal would be to produce plots like the following one, where I could simply show the y trends fixing the other independent variables.
I'm attaching here the dataf link: files.fm/f/tsmcsj3gh
Here instead the dput(head(dataf)):
> head(dataf)
Ref. H2 CO alfa P Temp ER Speed
1 Bouvet, 2011 50 50 0.5 1 295 0.4 13.64
2 Bouvet, 2011 50 50 0.5 1 295 0.6 42.31
3 Bouvet, 2011 50 50 0.5 1 295 0.8 72.83
4 Bouvet, 2011 50 50 0.5 1 295 1.0 96.88
5 Bouvet, 2011 50 50 0.5 1 295 1.2 118.61
6 Bouvet, 2011 50 50 0.5 1 295 1.5 149.13
> dput(head(dataf))
structure(list(Ref. = c("Bouvet, 2011", "Bouvet, 2011", "Bouvet, 2011",
"Bouvet, 2011", "Bouvet, 2011", "Bouvet, 2011"), H2 = c(50L,
50L, 50L, 50L, 50L, 50L), CO = c(50L, 50L, 50L, 50L, 50L, 50L
), alfa = c(0.5, 0.5, 0.5, 0.5, 0.5, 0.5), P = c(1L, 1L, 1L,
1L, 1L, 1L), Temp = c(295L, 295L, 295L, 295L, 295L, 295L), ER = c(0.4,
0.6, 0.8, 1, 1.2, 1.5), Speed = c(13.64, 42.31, 72.83, 96.88,
118.61, 149.13)), row.names = c(NA, 6L), class = "data.frame")