R: Adding a response variable to a design created with the rsm package

124 views Asked by At

I am currently learning about response surface modelling using R. I succesfully used the rsm package with its function ccd to create a central-composite-design. Now my question is, how do I add the data I collected to it, the actual data for my response variable that was obtained when doing the experiments? I want to fill y in the following example with my data, that I have as numbers in a data frame.

This is my code:

library(rsm)

ccd <- ccd(y ~ x1+x2+x3, n0 = c(0,3), alpha = "rotatable", randomize = F, oneblock = T

ccd

   run.order std.order  x1.as.is  x2.as.is  x3.as.is  y
1          1         1 -1.000000 -1.000000 -1.000000 NA
2          2         2  1.000000 -1.000000 -1.000000 NA
3          3         3 -1.000000  1.000000 -1.000000 NA
4          4         4  1.000000  1.000000 -1.000000 NA
5          5         5 -1.000000 -1.000000  1.000000 NA
6          6         6  1.000000 -1.000000  1.000000 NA
7          7         7 -1.000000  1.000000  1.000000 NA
8          8         8  1.000000  1.000000  1.000000 NA
9          1         1 -1.681793  0.000000  0.000000 NA
10         2         2  1.681793  0.000000  0.000000 NA
11         3         3  0.000000 -1.681793  0.000000 NA
12         4         4  0.000000  1.681793  0.000000 NA
13         5         5  0.000000  0.000000 -1.681793 NA
14         6         6  0.000000  0.000000  1.681793 NA
15         7         7  0.000000  0.000000  0.000000 NA
16         8         8  0.000000  0.000000  0.000000 NA
17         9         9  0.000000  0.000000  0.000000 NA

Data are stored in coded form using these coding formulas ...
x1 ~ x1.as.is
x2 ~ x2.as.is
x3 ~ x3.as.is
1

There are 1 answers

0
Richard On BEST ANSWER

As it turns out, the simplest solution ist quite often the right one. Storing the data in a data frame df of the same lenght, simple add it using

ccd$y <- df$y