In Refs. 1-2, the influence of several parameters for the taste of tea (sugar spoons, boiling time, amount of tea) was investigated using Central Composite Design or CCD. Here, we reproduces some of the main results for model determination using LinearModelFit . In addition, statistical and ANOVA analyses are provided as well as contour and 3 D plots shown on the same Figure.
real values of the three factors
In[]:=
low={10,30,4};high={30,80,8};
In[]:=
mid=0.5(low+high)
Out[]=
{20.,55.,6.}
In[]:=
halfrange=0.5(high-low)
Out[]=
{10.,25.,2.}
In[]:=
realvar={{20.,12.955,6.},{30.,30.,8.},{30.,30.,4.},{10.,30.,8.},{10.,30.,4.},{20.,55.,6.},{20.,55.,6.},{20.,55.,6.},{20.,55.,6.},{20.,55.,6.},{20.,55.,6.},{20.,55.,9.3636},{20.,55.,2.6364},{36.818,55.,6.},{3.182,55.,6.},{30.,80.,8.},{30.,80.,4.},{10.,80.,8.},{10.,80.,4.},{20.,97.045,6.}}
Out[]=
{{20.,12.955,6.},{30.,30.,8.},{30.,30.,4.},{10.,30.,8.},{10.,30.,4.},{20.,55.,6.},{20.,55.,6.},{20.,55.,6.},{20.,55.,6.},{20.,55.,6.},{20.,55.,6.},{20.,55.,9.3636},{20.,55.,2.6364},{36.818,55.,6.},{3.182,55.,6.},{30.,80.,8.},{30.,80.,4.},{10.,80.,8.},{10.,80.,4.},{20.,97.045,6.}}
In[]:=
Join[{{Style["time in min",Darker@Red],Style["tea in grams",Darker@Red],Style["sugar in spoons",Darker@Red]}},realvar]//TableForm
Out[]//TableForm=
time in min | tea in grams | sugar in spoons |
20. | 12.955 | 6. |
30. | 30. | 8. |
30. | 30. | 4. |
10. | 30. | 8. |
10. | 30. | 4. |
20. | 55. | 6. |
20. | 55. | 6. |
20. | 55. | 6. |
20. | 55. | 6. |
20. | 55. | 6. |
20. | 55. | 6. |
20. | 55. | 9.3636 |
20. | 55. | 2.6364 |
36.818 | 55. | 6. |
3.182 | 55. | 6. |
30. | 80. | 8. |
30. | 80. | 4. |
10. | 80. | 8. |
10. | 80. | 4. |
20. | 97.045 | 6. |
coded values of the three factors
In[]:=
codedvar=Table[-(mid[[j]]-realvar[[i,j]])/halfrange[[j]],{i,1,20},{j,1,3}]
Out[]=
{{0.,-1.6818,0.},{1.,-1.,1.},{1.,-1.,-1.},{-1.,-1.,1.},{-1.,-1.,-1.},{0.,0.,0.},{0.,0.,0.},{0.,0.,0.},{0.,0.,0.},{0.,0.,0.},{0.,0.,0.},{0.,0.,1.6818},{0.,0.,-1.6818},{1.6818,0.,0.},{-1.6818,0.,0.},{1.,1.,1.},{1.,1.,-1.},{-1.,1.,1.},{-1.,1.,-1.},{0.,1.6818,0.}}
In[]:=
codedvar//TableForm
Out[]//TableForm=
0. | -1.6818 | 0. |
1. | -1. | 1. |
1. | -1. | -1. |
-1. | -1. | 1. |
-1. | -1. | -1. |
0. | 0. | 0. |
0. | 0. | 0. |
0. | 0. | 0. |
0. | 0. | 0. |
0. | 0. | 0. |
0. | 0. | 0. |
0. | 0. | 1.6818 |
0. | 0. | -1.6818 |
1.6818 | 0. | 0. |
-1.6818 | 0. | 0. |
1. | 1. | 1. |
1. | 1. | -1. |
-1. | 1. | 1. |
-1. | 1. | -1. |
0. | 1.6818 | 0. |
Visualize the design using Graphics3D
In[]:=
Show[Graphics3D[{Darker@Red,PointSize[0.025],Table[Point[codedvar[[i]]],{i,1,20}]}],Axes->True]
Out[]=
we build the Computation Matrix
In[]:=
M=codedvar;
In[]:=
x1=Transpose[M][[1]]
Out[]=
{0.,1.,1.,-1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,1.6818,-1.6818,1.,1.,-1.,-1.,0.}
In[]:=
x2=Transpose[M][[2]]
Out[]=
{-1.6818,-1.,-1.,-1.,-1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,1.,1.,1.,1.,1.6818}
In[]:=
x3=Transpose[M][[3]]
Out[]=
{0.,1.,-1.,1.,-1.,0.,0.,0.,0.,0.,0.,1.6818,-1.6818,0.,0.,1.,-1.,1.,-1.,0.}
In[]:=
MD=Transpose[{{1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000},x1,x2,x3,x1x1,x2x2,x3x3,x1x2,x1x3,x2x3}];
In[]:=
Grid[Table[NumberForm[MD[[i,j]],{4,4}],{i,1,20},{j,1,10}],Frame->All]
Out[]=
1.0000 | 0.0000 | -1.6820 | 0.0000 | 0.0000 | 2.8280 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
1.0000 | 1.0000 | -1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | -1.0000 | 1.0000 | -1.0000 |
1.0000 | 1.0000 | -1.0000 | -1.0000 | 1.0000 | 1.0000 | 1.0000 | -1.0000 | -1.0000 | 1.0000 |
1.0000 | -1.0000 | -1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | -1.0000 | -1.0000 |
1.0000 | -1.0000 | -1.0000 | -1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 |
1.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
1.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
1.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
1.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
1.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
1.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
1.0000 | 0.0000 | 0.0000 | 1.6820 | 0.0000 | 0.0000 | 2.8280 | 0.0000 | 0.0000 | 0.0000 |
1.0000 | 0.0000 | 0.0000 | -1.6820 | 0.0000 | 0.0000 | 2.8280 | 0.0000 | 0.0000 | 0.0000 |
1.0000 | 1.6820 | 0.0000 | 0.0000 | 2.8280 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
1.0000 | -1.6820 | 0.0000 | 0.0000 | 2.8280 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 |
1.0000 | 1.0000 | 1.0000 | -1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | -1.0000 | -1.0000 |
1.0000 | -1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | 1.0000 | -1.0000 | -1.0000 | 1.0000 |
1.0000 | -1.0000 | 1.0000 | -1.0000 | 1.0000 | 1.0000 | 1.0000 | -1.0000 | 1.0000 | -1.0000 |
1.0000 | 0.0000 | 1.6820 | 0.0000 | 0.0000 | 2.8280 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
We assume the following taste values from a sensory panel (i.e., the responses)
In[]:=
Clear[x1,x2,x3]
In[]:=
yexp={5.54803,6.18096,6.34804,5.64553,3.69683,7.114,6.77,7.5,8,7.13,7.75318,5.48554,5.31762,6.32985,3.97331,5.32103,6.22119,6.01982,4.56998,5.75513};
In[]:=
Dimensions[yexp]
Out[]=
{20}
In[]:=
datalm={MD,yexp}
Out[]=
{{{1.,0.,-1.6818,0.,0.,2.82845,0.,0.,0.,0.},{1.,1.,-1.,1.,1.,1.,1.,-1.,1.,-1.},{1.,1.,-1.,-1.,1.,1.,1.,-1.,-1.,1.},{1.,-1.,-1.,1.,1.,1.,1.,1.,-1.,-1.},{1.,-1.,-1.,-1.,1.,1.,1.,1.,1.,1.},{1.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{1.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{1.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{1.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{1.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{1.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{1.,0.,0.,1.6818,0.,0.,2.82845,0.,0.,0.},{1.,0.,0.,-1.6818,0.,0.,2.82845,0.,0.,0.},{1.,1.6818,0.,0.,2.82845,0.,0.,0.,0.,0.},{1.,-1.6818,0.,0.,2.82845,0.,0.,0.,0.,0.},{1.,1.,1.,1.,1.,1.,1.,1.,1.,1.},{1.,1.,1.,-1.,1.,1.,1.,1.,-1.,-1.},{1.,-1.,1.,1.,1.,1.,1.,-1.,-1.,1.},{1.,-1.,1.,-1.,1.,1.,1.,-1.,1.,-1.},{1.,0.,1.6818,0.,0.,2.82845,0.,0.,0.,0.}},{5.54803,6.18096,6.34804,5.64553,3.69683,7.114,6.77,7.5,8,7.13,7.75318,5.48554,5.31762,6.32985,3.97331,5.32103,6.22119,6.01982,4.56998,5.75513}}
Linear Regression yields the model equation in terms of the coded factors
In[]:=
lm=LinearModelFit[datalm,{1,x1,x2,x3,x1x1,x2x2,x3x3,x1x2,x1x3,x2x3}]
Out[]=
FittedModel
In[]:=
Normal[lm]//Sort
Out[]=
7.3708+0.593274x1-0.740952x1x1-0.279278x1x2-0.558223x1x3+0.04459x2-0.564176x2x2-0.153992x2x3+0.191384x3-0.652564x3x3
Statistical and ANOVA analyses
Statistical and ANOVA analyses
A small p-value (typically < 0.05) means the variable significantly contributes to explaining the outcome.
A large p-value suggests the variable may not be important in the model and should be dropped from the model equation.
Clearly, the terms in the models involving: x2, x3, x1x2, and x2x3 have no significant effect on the tea taste.
A large p-value suggests the variable may not be important in the model and should be dropped from the model equation.
Clearly, the terms in the models involving: x2, x3, x1x2, and x2x3 have no significant effect on the tea taste.
In[]:=
lm[{"ParameterTable","RSquared"}]
Out[]=
,0.941374
Estimate | Standard Error | t-Statistic | P-Value | |
1 | 7.3708 | 0.1585 | 46.5036 | 5.09392× -13 10 |
x1 | 0.593274 | 0.105161 | 5.6416 | 0.000214935 |
x2 | 0.04459 | 0.105161 | 0.424017 | 0.68053 |
x3 | 0.191384 | 0.105161 | 1.81992 | 0.0987904 |
x1x1 | -0.740952 | 0.102371 | -7.23793 | 0.00002798 |
x2x2 | -0.564176 | 0.102371 | -5.51112 | 0.00025774 |
x3x3 | -0.652564 | 0.102371 | -6.37453 | 0.0000809258 |
x1x2 | -0.279278 | 0.137399 | -2.0326 | 0.0695022 |
x1x3 | -0.558223 | 0.137399 | -4.06278 | 0.0022764 |
x2x3 | -0.153992 | 0.137399 | -1.12077 | 0.288581 |
In[]:=
lm[{"AdjustedRSquared","EstimatedVariance","ANOVATable"}]
Out[]=
0.888611,0.151029,
DF | SS | MS | F-Statistic | P-Value | |
x1 | 1 | 4.80688 | 4.80688 | 31.8276 | 0.000214935 |
x2 | 1 | 0.0271535 | 0.0271535 | 0.179791 | 0.68053 |
x3 | 1 | 0.500221 | 0.500221 | 3.3121 | 0.0987904 |
x1x1 | 1 | 5.84374 | 5.84374 | 38.6929 | 0.0000987922 |
x2x2 | 1 | 3.6297 | 3.6297 | 24.0332 | 0.000620924 |
x3x3 | 1 | 6.13698 | 6.13698 | 40.6346 | 0.0000809258 |
x1x2 | 1 | 0.623967 | 0.623967 | 4.13145 | 0.0695022 |
x1x3 | 1 | 2.4929 | 2.4929 | 16.5061 | 0.0022764 |
x2x3 | 1 | 0.18971 | 0.18971 | 1.25612 | 0.288581 |
Error | 10 | 1.51029 | 0.151029 | | |
Total | 19 | 25.7615 | | | |
model equation in terms of the real factors
the model’s parameters in a Table
plot of experimental response versus predicted response
plot of residuals
3-D and contour plot for x3=0
Pareto Chart of Standardized Effects with significance threshold (dotted red line).
This chart confirms that only x1, x1x1, x2x2, x3x3 and x1x3 are significant.
This chart confirms that only x1, x1x1, x2x2, x3x3 and x1x3 are significant.
References
References
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Central composite design (CCD) for the optimization of tea taste
by Housam Binous and Ahmed Bellagi
Wolfram Community, STAFF PICKS, November 8, 2025
https://community.wolfram.com/groups/-/m/t/3571848
by Housam Binous and Ahmed Bellagi
Wolfram Community, STAFF PICKS, November 8, 2025
https://community.wolfram.com/groups/-/m/t/3571848