Summary
This experiment investigates compost maturity optimization. Box-Behnken design to minimize maturation time and maximize nutrient content by tuning C:N ratio, moisture, and turning frequency.
The design varies 3 factors: cn ratio (ratio), ranging from 20 to 40, moisture pct (%), ranging from 40 to 65, and turn freq (per_week), ranging from 1 to 7. The goal is to optimize 2 responses: maturity weeks (weeks) (minimize) and nutrient score (pts) (maximize). Fixed conditions held constant across all runs include pile volume = 1m3, initial material = mixed_greens_browns.
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 maturity weeks, the most influential factors were moisture pct (54.5%), cn ratio (26.7%), turn freq (18.8%). The best observed value was 8.4 (at cn ratio = 30, moisture pct = 40, turn freq = 7).
For nutrient score, the most influential factors were moisture pct (52.9%), cn ratio (26.5%), turn freq (20.6%). The best observed value was 7.1 (at cn ratio = 30, moisture pct = 40, turn freq = 7).
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 |
cn_ratio | 20 | 40 | ratio |
moisture_pct | 40 | 65 | % |
turn_freq | 1 | 7 | per_week |
Fixed: pile_volume = 1m3, initial_material = mixed_greens_browns
Responses
| Response | Direction | Unit |
maturity_weeks | ↓ minimize | weeks |
nutrient_score | ↑ maximize | pts |
Configuration
{
"metadata": {
"name": "Compost Maturity Optimization",
"description": "Box-Behnken design to minimize maturation time and maximize nutrient content by tuning C:N ratio, moisture, and turning frequency"
},
"factors": [
{
"name": "cn_ratio",
"levels": [
"20",
"40"
],
"type": "continuous",
"unit": "ratio"
},
{
"name": "moisture_pct",
"levels": [
"40",
"65"
],
"type": "continuous",
"unit": "%"
},
{
"name": "turn_freq",
"levels": [
"1",
"7"
],
"type": "continuous",
"unit": "per_week"
}
],
"fixed_factors": {
"pile_volume": "1m3",
"initial_material": "mixed_greens_browns"
},
"responses": [
{
"name": "maturity_weeks",
"optimize": "minimize",
"unit": "weeks"
},
{
"name": "nutrient_score",
"optimize": "maximize",
"unit": "pts"
}
],
"settings": {
"operation": "box_behnken",
"test_script": "use_cases/98_compost_maturity/sim.sh"
}
}
Experimental Matrix
The Box-Behnken Design produces 15 runs. Each row is one experiment with specific factor settings.
| Run | cn_ratio | moisture_pct | turn_freq |
| 1 | 30 | 40 | 1 |
| 2 | 30 | 52.5 | 4 |
| 3 | 40 | 52.5 | 7 |
| 4 | 40 | 52.5 | 1 |
| 5 | 30 | 52.5 | 4 |
| 6 | 30 | 52.5 | 4 |
| 7 | 20 | 52.5 | 7 |
| 8 | 40 | 40 | 4 |
| 9 | 30 | 40 | 7 |
| 10 | 40 | 65 | 4 |
| 11 | 20 | 52.5 | 1 |
| 12 | 30 | 65 | 7 |
| 13 | 20 | 40 | 4 |
| 14 | 20 | 65 | 4 |
| 15 | 30 | 65 | 1 |
Step-by-Step Workflow
1
Preview the design
$ doe info --config use_cases/98_compost_maturity/config.json
2
Generate the runner script
$ doe generate --config use_cases/98_compost_maturity/config.json \
--output use_cases/98_compost_maturity/results/run.sh --seed 42
3
Execute the experiments
$ bash use_cases/98_compost_maturity/results/run.sh
4
Analyze results
$ doe analyze --config use_cases/98_compost_maturity/config.json
5
Get optimization recommendations
$ doe optimize --config use_cases/98_compost_maturity/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/98_compost_maturity/config.json --multi
7
Generate the HTML report
$ doe report --config use_cases/98_compost_maturity/config.json \
--output use_cases/98_compost_maturity/results/report.html
Features Exercised
| Feature | Value |
| Design type | box_behnken |
| Factor types | continuous (all 3) |
| Arg style | double-dash |
| Responses | 2 (maturity_weeks ↓, nutrient_score ↑) |
| Total runs | 15 |
Analysis Results
Generated from actual experiment runs using the DOE Helper Tool.
Response: maturity_weeks
Top factors: moisture_pct (54.5%), cn_ratio (26.7%), turn_freq (18.8%).
ANOVA
| Source | DF | SS | MS | F | p-value |
| Source | DF | SS | MS | F | p-value |
| cn_ratio | 2 | 4.1172 | 2.0586 | 1.532 | 0.2733 |
| moisture_pct | 2 | 20.9922 | 10.4961 | 7.813 | 0.0131 |
| turn_freq | 2 | 2.2622 | 1.1311 | 0.842 | 0.4657 |
| Lack | of | Fit | 6 | 119.5711 | 19.9285 |
| Pure | Error | 2 | 2.6867 | | |
| Error | 8 | 122.2578 | 1.3433 | | |
| Total | 14 | 149.6293 | 10.6878 | | |
Pareto Chart
Main Effects Plot
Normal Probability Plot of Effects
Half-Normal Plot of Effects
Model Diagnostics
Response: nutrient_score
Top factors: moisture_pct (52.9%), cn_ratio (26.5%), turn_freq (20.6%).
ANOVA
| Source | DF | SS | MS | F | p-value |
| Source | DF | SS | MS | F | p-value |
| cn_ratio | 2 | 0.9173 | 0.4587 | 0.604 | 0.5700 |
| moisture_pct | 2 | 3.3373 | 1.6687 | 2.196 | 0.1737 |
| turn_freq | 2 | 0.5652 | 0.2826 | 0.372 | 0.7008 |
| Lack | of | Fit | 6 | 5.5775 | 0.9296 |
| Pure | Error | 2 | 1.5200 | | |
| Error | 8 | 7.0975 | 0.7600 | | |
| Total | 14 | 11.9173 | 0.8512 | | |
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.
maturity weeks cn ratio vs moisture pct
maturity weeks cn ratio vs turn freq
maturity weeks moisture pct vs turn freq
nutrient score cn ratio vs moisture pct
nutrient score cn ratio vs turn freq
nutrient score moisture pct vs turn freq
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.9545
Per-Response Desirability
| Response | Weight | Desirability | Predicted | Dir |
maturity_weeks |
1.0 |
|
8.40 0.9545 8.40 weeks |
↓ |
nutrient_score |
1.5 |
|
7.10 0.9545 7.10 pts |
↑ |
Recommended Settings
| Factor | Value |
cn_ratio | 20 ratio |
moisture_pct | 40 % |
turn_freq | 4 per_week |
Source: from observed run #3
Trade-off Summary
Sacrifice = how much worse than single-objective best.
| Response | Predicted | Best Observed | Sacrifice |
nutrient_score | 7.10 | 7.10 | +0.00 |
Top 3 Runs by Desirability
| Run | D | Factor Settings |
| #12 | 0.8132 | cn_ratio=40, moisture_pct=65, turn_freq=4 |
| #10 | 0.7364 | cn_ratio=40, moisture_pct=52.5, turn_freq=7 |
Model Quality
| Response | R² | Type |
nutrient_score | 0.8922 | quadratic |
Full Multi-Objective Output
============================================================
MULTI-OBJECTIVE OPTIMIZATION
Method: Derringer-Suich Desirability Function
============================================================
Overall desirability: D = 0.9545
Response Weight Desirability Predicted Direction
---------------------------------------------------------------------
maturity_weeks 1.0 0.9545 8.40 weeks ↓
nutrient_score 1.5 0.9545 7.10 pts ↑
Recommended settings:
cn_ratio = 20 ratio
moisture_pct = 40 %
turn_freq = 4 per_week
(from observed run #3)
Trade-off summary:
maturity_weeks: 8.40 (best observed: 8.40, sacrifice: +0.00)
nutrient_score: 7.10 (best observed: 7.10, sacrifice: +0.00)
Model quality:
maturity_weeks: R² = 0.7224 (quadratic)
nutrient_score: R² = 0.8922 (quadratic)
Top 3 observed runs by overall desirability:
1. Run #3 (D=0.9545): cn_ratio=20, moisture_pct=40, turn_freq=4
2. Run #12 (D=0.8132): cn_ratio=40, moisture_pct=65, turn_freq=4
3. Run #10 (D=0.7364): cn_ratio=40, moisture_pct=52.5, turn_freq=7
Full Analysis Output
=== Main Effects: maturity_weeks ===
Factor Effect Std Error % Contribution
--------------------------------------------------------------
moisture_pct 2.5929 0.8441 54.5%
cn_ratio 1.2679 0.8441 26.7%
turn_freq 0.8929 0.8441 18.8%
=== ANOVA Table: maturity_weeks ===
Source DF SS MS F p-value
-----------------------------------------------------------------------------
cn_ratio 2 4.1172 2.0586 1.532 0.2733
moisture_pct 2 20.9922 10.4961 7.813 0.0131
turn_freq 2 2.2622 1.1311 0.842 0.4657
Lack of Fit 6 119.5711 19.9285 14.835 0.0645
Pure Error 2 2.6867 1.3433
Error 8 122.2578 1.3433
Total 14 149.6293 10.6878
=== Summary Statistics: maturity_weeks ===
cn_ratio:
Level N Mean Std Min Max
------------------------------------------------------------
20 4 12.3750 4.7169 8.4000 17.9000
30 7 13.6429 2.6906 11.2000 18.5000
40 4 13.2750 3.4316 10.3000 18.2000
moisture_pct:
Level N Mean Std Min Max
------------------------------------------------------------
40 4 14.0500 3.4694 10.3000 18.5000
52.5 7 11.9571 3.3371 8.4000 18.2000
65 4 14.5500 2.9275 11.9000 17.9000
turn_freq:
Level N Mean Std Min Max
------------------------------------------------------------
1 4 13.8500 4.2821 8.4000 18.2000
4 7 12.9571 2.6229 10.3000 17.9000
7 4 13.0000 4.1263 8.5000 18.5000
=== Main Effects: nutrient_score ===
Factor Effect Std Error % Contribution
--------------------------------------------------------------
moisture_pct 1.2000 0.2382 52.9%
cn_ratio 0.6000 0.2382 26.5%
turn_freq 0.4679 0.2382 20.6%
=== ANOVA Table: nutrient_score ===
Source DF SS MS F p-value
-----------------------------------------------------------------------------
cn_ratio 2 0.9173 0.4587 0.604 0.5700
moisture_pct 2 3.3373 1.6687 2.196 0.1737
turn_freq 2 0.5652 0.2826 0.372 0.7008
Lack of Fit 6 5.5775 0.9296 1.223 0.5147
Pure Error 2 1.5200 0.7600
Error 8 7.0975 0.7600
Total 14 11.9173 0.8512
=== Summary Statistics: nutrient_score ===
cn_ratio:
Level N Mean Std Min Max
------------------------------------------------------------
20 4 5.6000 1.1225 4.6000 7.1000
30 7 5.4000 0.9557 3.9000 6.7000
40 4 6.0000 0.7616 5.4000 7.1000
moisture_pct:
Level N Mean Std Min Max
------------------------------------------------------------
40 4 4.8500 0.7506 3.9000 5.5000
52.5 7 5.8000 0.7895 4.4000 7.1000
65 4 6.0500 1.0247 4.9000 7.1000
turn_freq:
Level N Mean Std Min Max
------------------------------------------------------------
1 4 5.9250 0.7848 5.5000 7.1000
4 7 5.4571 0.9378 4.4000 7.1000
7 4 5.5750 1.1871 3.9000 6.7000
Optimization Recommendations
=== Optimization: maturity_weeks ===
Direction: minimize
Best observed run: #3
cn_ratio = 30
moisture_pct = 40
turn_freq = 7
Value: 8.4
RSM Model (linear, R² = 0.1793, Adj R² = -0.0445):
Coefficients:
intercept +13.2067
cn_ratio +1.3750
moisture_pct +1.1500
turn_freq -0.3750
RSM Model (quadratic, R² = 0.7906, Adj R² = 0.4137):
Coefficients:
intercept +10.5333
cn_ratio +1.3750
moisture_pct +1.1500
turn_freq -0.3750
cn_ratio*moisture_pct +0.1750
cn_ratio*turn_freq -2.7750
moisture_pct*turn_freq +1.5750
cn_ratio^2 +3.4208
moisture_pct^2 -0.0292
turn_freq^2 +1.6208
Curvature analysis:
cn_ratio coef=+3.4208 convex (has a minimum)
turn_freq coef=+1.6208 convex (has a minimum)
moisture_pct coef=-0.0292 negligible curvature
Notable interactions:
cn_ratio*turn_freq coef=-2.7750 (antagonistic)
moisture_pct*turn_freq coef=+1.5750 (synergistic)
Predicted optimum (from quadratic model, at observed points):
cn_ratio = 40
moisture_pct = 52.5
turn_freq = 1
Predicted value: 20.1000
Surface optimum (via L-BFGS-B, quadratic model):
cn_ratio = 31.0507
moisture_pct = 40
turn_freq = 6.07447
Predicted value: 8.7430
Model quality: Good fit — general trends are captured, some noise remains.
Factor importance:
1. cn_ratio (effect: 4.7, contribution: 53.6%)
2. moisture_pct (effect: 2.3, contribution: 26.3%)
3. turn_freq (effect: 1.8, contribution: 20.1%)
=== Optimization: nutrient_score ===
Direction: maximize
Best observed run: #3
cn_ratio = 30
moisture_pct = 40
turn_freq = 7
Value: 7.1
RSM Model (linear, R² = 0.1911, Adj R² = -0.0295):
Coefficients:
intercept +5.6133
cn_ratio +0.3750
moisture_pct -0.3625
turn_freq +0.1125
RSM Model (quadratic, R² = 0.5541, Adj R² = -0.2486):
Coefficients:
intercept +6.2333
cn_ratio +0.3750
moisture_pct -0.3625
turn_freq +0.1125
cn_ratio*moisture_pct -0.3000
cn_ratio*turn_freq +0.4000
moisture_pct*turn_freq -0.5250
cn_ratio^2 -0.7042
moisture_pct^2 -0.0792
turn_freq^2 -0.3792
Curvature analysis:
cn_ratio coef=-0.7042 concave (has a maximum)
turn_freq coef=-0.3792 concave (has a maximum)
moisture_pct coef=-0.0792 negligible curvature
Notable interactions:
moisture_pct*turn_freq coef=-0.5250 (antagonistic)
cn_ratio*turn_freq coef=+0.4000 (synergistic)
Predicted optimum (from linear model, at observed points):
cn_ratio = 40
moisture_pct = 40
turn_freq = 4
Predicted value: 6.3508
Surface optimum (via L-BFGS-B, linear model):
cn_ratio = 40
moisture_pct = 40
turn_freq = 7
Predicted value: 6.4633
Model quality: Weak fit — consider adding center points or using a different design.
Factor importance:
1. cn_ratio (effect: 1.0, contribution: 47.4%)
2. moisture_pct (effect: 0.7, contribution: 32.8%)
3. turn_freq (effect: 0.4, contribution: 19.7%)