Summary
This experiment investigates dairy cow feed ration. Box-Behnken design to maximize milk yield and minimize feed cost by tuning forage-to-concentrate ratio, protein supplement, and energy density.
The design varies 3 factors: forage pct (%), ranging from 40 to 70, protein pct (%CP), ranging from 14 to 20, and energy mcal (Mcal/kg), ranging from 1.5 to 1.8. The goal is to optimize 2 responses: milk kg day (kg/day) (maximize) and feed cost day (USD/day) (minimize). Fixed conditions held constant across all runs include breed = holstein, lactation stage = mid.
A Box-Behnken design was chosen because it efficiently fits quadratic models with 3 continuous factors while avoiding extreme corner combinations — requiring only 15 runs instead of the 8 needed for a full factorial at two levels.
Quadratic response surface models were fitted to capture potential curvature and factor interactions. The RSM contour plots below visualize how pairs of factors jointly affect each response.
Key Findings
For milk kg day, the most influential factors were protein pct (44.2%), energy mcal (28.8%), forage pct (27.0%). The best observed value was 35.2 (at forage pct = 40, protein pct = 17, energy mcal = 1.8).
For feed cost day, the most influential factors were protein pct (47.4%), energy mcal (29.3%), forage pct (23.3%). The best observed value was 5.03 (at forage pct = 55, protein pct = 20, energy mcal = 1.5).
Recommended Next Steps
- Run confirmation experiments at the predicted optimal settings to validate the model.
- Consider whether any fixed factors should be varied in a future study.
Experimental Setup
Factors
| Factor | Low | High | Unit |
forage_pct | 40 | 70 | % |
protein_pct | 14 | 20 | %CP |
energy_mcal | 1.5 | 1.8 | Mcal/kg |
Fixed: breed = holstein, lactation_stage = mid
Responses
| Response | Direction | Unit |
milk_kg_day | ↑ maximize | kg/day |
feed_cost_day | ↓ minimize | USD/day |
Configuration
{
"metadata": {
"name": "Dairy Cow Feed Ration",
"description": "Box-Behnken design to maximize milk yield and minimize feed cost by tuning forage-to-concentrate ratio, protein supplement, and energy density"
},
"factors": [
{
"name": "forage_pct",
"levels": [
"40",
"70"
],
"type": "continuous",
"unit": "%"
},
{
"name": "protein_pct",
"levels": [
"14",
"20"
],
"type": "continuous",
"unit": "%CP"
},
{
"name": "energy_mcal",
"levels": [
"1.5",
"1.8"
],
"type": "continuous",
"unit": "Mcal/kg"
}
],
"fixed_factors": {
"breed": "holstein",
"lactation_stage": "mid"
},
"responses": [
{
"name": "milk_kg_day",
"optimize": "maximize",
"unit": "kg/day"
},
{
"name": "feed_cost_day",
"optimize": "minimize",
"unit": "USD/day"
}
],
"settings": {
"operation": "box_behnken",
"test_script": "use_cases/291_dairy_cow_nutrition/sim.sh"
}
}
Experimental Matrix
The Box-Behnken Design produces 15 runs. Each row is one experiment with specific factor settings.
| Run | forage_pct | protein_pct | energy_mcal |
| 1 | 55 | 14 | 1.5 |
| 2 | 55 | 17 | 1.65 |
| 3 | 70 | 17 | 1.8 |
| 4 | 70 | 17 | 1.5 |
| 5 | 55 | 17 | 1.65 |
| 6 | 55 | 17 | 1.65 |
| 7 | 40 | 17 | 1.8 |
| 8 | 70 | 14 | 1.65 |
| 9 | 55 | 14 | 1.8 |
| 10 | 70 | 20 | 1.65 |
| 11 | 40 | 17 | 1.5 |
| 12 | 55 | 20 | 1.8 |
| 13 | 40 | 14 | 1.65 |
| 14 | 40 | 20 | 1.65 |
| 15 | 55 | 20 | 1.5 |
Step-by-Step Workflow
1
Preview the design
$ doe info --config use_cases/291_dairy_cow_nutrition/config.json
2
Generate the runner script
$ doe generate --config use_cases/291_dairy_cow_nutrition/config.json \
--output use_cases/291_dairy_cow_nutrition/results/run.sh --seed 42
3
Execute the experiments
$ bash use_cases/291_dairy_cow_nutrition/results/run.sh
4
Analyze results
$ doe analyze --config use_cases/291_dairy_cow_nutrition/config.json
5
Get optimization recommendations
$ doe optimize --config use_cases/291_dairy_cow_nutrition/config.json
6
Multi-objective optimization
With 2 competing responses, use --multi to find the best compromise via Derringer–Suich desirability.
$ doe optimize --config use_cases/291_dairy_cow_nutrition/config.json --multi
7
Generate the HTML report
$ doe report --config use_cases/291_dairy_cow_nutrition/config.json \
--output use_cases/291_dairy_cow_nutrition/results/report.html
Features Exercised
| Feature | Value |
| Design type | box_behnken |
| Factor types | continuous (all 3) |
| Arg style | double-dash |
| Responses | 2 (milk_kg_day ↑, feed_cost_day ↓) |
| Total runs | 15 |
Analysis Results
Generated from actual experiment runs using the DOE Helper Tool.
Response: milk_kg_day
Top factors: protein_pct (44.2%), energy_mcal (28.8%), forage_pct (27.0%).
ANOVA
| Source | DF | SS | MS | F | p-value |
| Source | DF | SS | MS | F | p-value |
| forage_pct | 2 | 32.4275 | 16.2138 | 1.378 | 0.3059 |
| protein_pct | 2 | 87.2475 | 43.6238 | 3.708 | 0.0725 |
| energy_mcal | 2 | 49.2508 | 24.6254 | 2.093 | 0.1857 |
| Lack | of | Fit | 6 | 126.9568 | 21.1595 |
| Pure | Error | 2 | 23.5267 | | |
| Error | 8 | 150.4835 | 11.7633 | | |
| Total | 14 | 319.4093 | 22.8150 | | |
Pareto Chart
Main Effects Plot
Normal Probability Plot of Effects
Half-Normal Plot of Effects
Model Diagnostics
Response: feed_cost_day
Top factors: protein_pct (47.4%), energy_mcal (29.3%), forage_pct (23.3%).
ANOVA
| Source | DF | SS | MS | F | p-value |
| Source | DF | SS | MS | F | p-value |
| forage_pct | 2 | 4.1522 | 2.0761 | 0.835 | 0.4684 |
| protein_pct | 2 | 14.8647 | 7.4324 | 2.990 | 0.1072 |
| energy_mcal | 2 | 7.2910 | 3.6455 | 1.467 | 0.2867 |
| Lack | of | Fit | 6 | 19.9135 | 3.3189 |
| Pure | Error | 2 | 4.9717 | | |
| Error | 8 | 24.8852 | 2.4858 | | |
| Total | 14 | 51.1932 | 3.6567 | | |
Pareto Chart
Main Effects Plot
Normal Probability Plot of Effects
Half-Normal Plot of Effects
Model Diagnostics
Response Surface Plots
3D surfaces fitted with quadratic RSM. Red dots are observed data points.
feed cost day forage pct vs energy mcal
feed cost day forage pct vs protein pct
feed cost day protein pct vs energy mcal
milk kg day forage pct vs energy mcal
milk kg day forage pct vs protein pct
milk kg day protein pct vs energy mcal
Multi-Objective Optimization
When responses compete, Derringer–Suich desirability finds the best compromise.
Each response is scaled to a 0–1 desirability, then combined via a weighted geometric mean.
Overall Desirability
D = 0.6190
Per-Response Desirability
| Response | Weight | Desirability | Predicted | Dir |
milk_kg_day |
1.5 |
|
30.60 0.7056 30.60 kg/day |
↑ |
feed_cost_day |
1.0 |
|
8.16 0.5085 8.16 USD/day |
↓ |
Recommended Settings
| Factor | Value |
forage_pct | 55 % |
protein_pct | 20 %CP |
energy_mcal | 1.8 Mcal/kg |
Source: from observed run #2
Trade-off Summary
Sacrifice = how much worse than single-objective best.
| Response | Predicted | Best Observed | Sacrifice |
feed_cost_day | 8.16 | 5.03 | +3.13 |
Top 3 Runs by Desirability
| Run | D | Factor Settings |
| #13 | 0.5936 | forage_pct=70, protein_pct=17, energy_mcal=1.5 |
| #5 | 0.5690 | forage_pct=55, protein_pct=17, energy_mcal=1.65 |
Model Quality
| Response | R² | Type |
feed_cost_day | 0.0444 | linear |
Full Multi-Objective Output
============================================================
MULTI-OBJECTIVE OPTIMIZATION
Method: Derringer-Suich Desirability Function
============================================================
Overall desirability: D = 0.6190
Response Weight Desirability Predicted Direction
---------------------------------------------------------------------
milk_kg_day 1.5 0.7056 30.60 kg/day ↑
feed_cost_day 1.0 0.5085 8.16 USD/day ↓
Recommended settings:
forage_pct = 55 %
protein_pct = 20 %CP
energy_mcal = 1.8 Mcal/kg
(from observed run #2)
Trade-off summary:
milk_kg_day: 30.60 (best observed: 35.20, sacrifice: +4.60)
feed_cost_day: 8.16 (best observed: 5.03, sacrifice: +3.13)
Model quality:
milk_kg_day: R² = 0.0776 (linear)
feed_cost_day: R² = 0.0444 (linear)
Top 3 observed runs by overall desirability:
1. Run #2 (D=0.6190): forage_pct=55, protein_pct=20, energy_mcal=1.8
2. Run #13 (D=0.5936): forage_pct=70, protein_pct=17, energy_mcal=1.5
3. Run #5 (D=0.5690): forage_pct=55, protein_pct=17, energy_mcal=1.65
Full Analysis Output
=== Main Effects: milk_kg_day ===
Factor Effect Std Error % Contribution
--------------------------------------------------------------
protein_pct 6.5750 1.2333 44.2%
energy_mcal 4.2857 1.2333 28.8%
forage_pct 4.0250 1.2333 27.0%
=== ANOVA Table: milk_kg_day ===
Source DF SS MS F p-value
-----------------------------------------------------------------------------
forage_pct 2 32.4275 16.2138 1.378 0.3059
protein_pct 2 87.2475 43.6238 3.708 0.0725
energy_mcal 2 49.2508 24.6254 2.093 0.1857
Lack of Fit 6 126.9568 21.1595 1.799 0.3995
Pure Error 2 23.5267 11.7633
Error 8 150.4835 11.7633
Total 14 319.4093 22.8150
=== Summary Statistics: milk_kg_day ===
forage_pct:
Level N Mean Std Min Max
------------------------------------------------------------
40 4 25.9750 5.4993 18.4000 30.6000
55 7 28.0714 4.0323 22.9000 34.8000
70 4 30.0000 5.7359 22.3000 35.2000
protein_pct:
Level N Mean Std Min Max
------------------------------------------------------------
14 4 31.1000 5.2928 23.8000 35.2000
17 7 28.2714 3.3084 22.9000 33.4000
20 4 24.5250 5.2424 18.4000 30.3000
energy_mcal:
Level N Mean Std Min Max
------------------------------------------------------------
1.5 4 31.0000 4.1207 25.5000 34.8000
1.65 7 26.7143 5.7632 18.4000 35.2000
1.8 4 27.3500 2.5775 23.8000 29.4000
=== Main Effects: feed_cost_day ===
Factor Effect Std Error % Contribution
--------------------------------------------------------------
protein_pct 2.7050 0.4937 47.4%
energy_mcal 1.6721 0.4937 29.3%
forage_pct 1.3325 0.4937 23.3%
=== ANOVA Table: feed_cost_day ===
Source DF SS MS F p-value
-----------------------------------------------------------------------------
forage_pct 2 4.1522 2.0761 0.835 0.4684
protein_pct 2 14.8647 7.4324 2.990 0.1072
energy_mcal 2 7.2910 3.6455 1.467 0.2867
Lack of Fit 6 19.9135 3.3189 1.335 0.4876
Pure Error 2 4.9717 2.4858
Error 8 24.8852 2.4858
Total 14 51.1932 3.6567
=== Summary Statistics: feed_cost_day ===
forage_pct:
Level N Mean Std Min Max
------------------------------------------------------------
40 4 7.3425 1.5628 5.1200 8.6500
55 7 8.4100 1.6910 6.2500 11.4100
70 4 8.6750 2.7421 5.0300 11.3600
protein_pct:
Level N Mean Std Min Max
------------------------------------------------------------
14 4 9.4325 2.3220 6.8000 11.4100
17 7 8.3286 1.2400 6.2500 10.0500
20 4 6.7275 1.9086 5.0300 8.4000
energy_mcal:
Level N Mean Std Min Max
------------------------------------------------------------
1.5 4 9.3250 1.7589 7.4400 11.4100
1.65 7 7.6529 2.3296 5.0300 11.3600
1.8 4 8.0175 0.8283 6.8000 8.6500
Optimization Recommendations
=== Optimization: milk_kg_day ===
Direction: maximize
Best observed run: #12
forage_pct = 40
protein_pct = 17
energy_mcal = 1.8
Value: 35.2
RSM Model (linear, R² = 0.3932, Adj R² = 0.2277):
Coefficients:
intercept +28.0267
forage_pct -3.2125
protein_pct +1.8000
energy_mcal +1.4625
RSM Model (quadratic, R² = 0.7818, Adj R² = 0.3890):
Coefficients:
intercept +28.4667
forage_pct -3.2125
protein_pct +1.8000
energy_mcal +1.4625
forage_pct*protein_pct +0.2250
forage_pct*energy_mcal -2.7000
protein_pct*energy_mcal +1.4250
forage_pct^2 +2.3167
protein_pct^2 -3.9583
energy_mcal^2 +0.8167
Curvature analysis:
protein_pct coef=-3.9583 concave (has a maximum)
forage_pct coef=+2.3167 convex (has a minimum)
energy_mcal coef=+0.8167 convex (has a minimum)
Notable interactions:
forage_pct*energy_mcal coef=-2.7000 (antagonistic)
protein_pct*energy_mcal coef=+1.4250 (synergistic)
Predicted optimum (from quadratic model, at observed points):
forage_pct = 40
protein_pct = 17
energy_mcal = 1.8
Predicted value: 38.9750
Surface optimum (via L-BFGS-B, quadratic model):
forage_pct = 40
protein_pct = 18.1368
energy_mcal = 1.8
Predicted value: 39.5434
Model quality: Good fit — general trends are captured, some noise remains.
Factor importance:
1. forage_pct (effect: 6.4, contribution: 41.9%)
2. protein_pct (effect: 6.0, contribution: 39.0%)
3. energy_mcal (effect: 2.9, contribution: 19.1%)
=== Optimization: feed_cost_day ===
Direction: minimize
Best observed run: #1
forage_pct = 55
protein_pct = 20
energy_mcal = 1.5
Value: 5.03
RSM Model (linear, R² = 0.3171, Adj R² = 0.1309):
Coefficients:
intercept +8.1960
forage_pct -1.0625
protein_pct +0.5237
energy_mcal +0.7913
RSM Model (quadratic, R² = 0.7917, Adj R² = 0.4167):
Coefficients:
intercept +8.3067
forage_pct -1.0625
protein_pct +0.5237
energy_mcal +0.7913
forage_pct*protein_pct -0.3325
forage_pct*energy_mcal -0.8525
protein_pct*energy_mcal +0.4850
forage_pct^2 +1.3792
protein_pct^2 -1.7533
energy_mcal^2 +0.1667
Curvature analysis:
protein_pct coef=-1.7533 concave (has a maximum)
forage_pct coef=+1.3792 convex (has a minimum)
energy_mcal coef=+0.1667 convex (has a minimum)
Notable interactions:
forage_pct*energy_mcal coef=-0.8525 (antagonistic)
protein_pct*energy_mcal coef=+0.4850 (synergistic)
forage_pct*protein_pct coef=-0.3325 (antagonistic)
Predicted optimum (from quadratic model, at observed points):
forage_pct = 40
protein_pct = 17
energy_mcal = 1.8
Predicted value: 12.5588
Surface optimum (via L-BFGS-B, quadratic model):
forage_pct = 54.3338
protein_pct = 14
energy_mcal = 1.5
Predicted value: 5.8873
Model quality: Good fit — general trends are captured, some noise remains.
Factor importance:
1. forage_pct (effect: 2.6, contribution: 39.2%)
2. protein_pct (effect: 2.4, contribution: 36.6%)
3. energy_mcal (effect: 1.6, contribution: 24.3%)