I am trying to label the graphs from the data. A=IP 180 OIL B=Completed Feet C=# of Stages Yield=OIL EUR
I cant figure out how to do it. Im learning so please dont laugh.
also need to know how to label each of the graphs individually
type or paste code here```{r}
yield_data <- readr::read_csv("data/Yield_data.csv")
head(yield_data)
yield_data <- coded.data(
yield_data, # Experimental data
formulas = list( # List of coding formulas for each factor
x1 ~ (A - 1571)/1442,
x2 ~ (B - 1811)/1753,
x3 ~ (C - 33.5)/24.5,
))
head(yield_data)
yield_model <- rsm(Yield ~ SO(x1, x2, x3), data = yield_data)
summary(yield_model)
capture.output(
summary(yield_model), # Object to be exported
file = "data/model_summary.txt" # File name
)
par(mfrow = c(2,3)) # 2 x 3 pictures on one plot
contour(
yield_model, # Our model
~ x1 + x2 + x3, # A formula to obtain the 6 possible graphs
image = TRUE, main='variables', xlab=(), ylab=() # If image = TRUE, apply color to each contour
)
# Specify axis options within plot()
plot(x, y, main="title", sub="subtitle",
xlab="X-axis label", ylab="y-axix label",
xlim=c(10, 10), ylim=c(10, 10))
jpeg(
filename = "graphs/model_contours.jpeg", width = 30, height = 20,
units = "cm", res = 400, quality = 100
)
par(mfrow = c(2,3))
contour(
yield_model,
~ x1 + x2 + x3,
image = TRUE,
)
dev.off()
par(mfrow = c(2,3)) # 2 x 3 pictures on one plot
persp(
yield_model, # Our model
~ x1 + x2 + x3, # A formula to obtain the 6 possible graphs
col = topo.colors(100), # Color palette
contours = "colors" # Include contours with the same color palette
)
jpeg(
filename = "graphs/model_3D.jpeg", width = 30, height = 20,
units = "cm", res = 400, quality = 100
)
par(mfrow = c(2,3)) # 2 x 3 pictures on one plot
persp(
yield_model, # Our model
~ x1 + x2 + x3, # A formula to obtain the 6 possible graphs
col = topo.colors(100), # Color palette
contours = "colors" # Include contours with the same color palette
)
dev.off()
opt_point <- summary(yield_model)$canonical$xs
opt_point
op_point_ru <- code2val(
opt_point, # Optimal point in coded units
codings = codings(yield_data) # Formulas to convert to factor units
)
op_point_ru
opt_point_df <- data.frame( # predict() needs a data frame with the points
x1 = opt_point[1], # to be predicted
x2 = opt_point[2],
x3 = opt_point[3]
)
best_response <- predict(
yield_model, # Our model
opt_point_df # Data frame with points to be predicted
)
names(best_response) <- "Best yield" # A nice name to our best point
best_response
## Best yield
## 232.0112