0
# Response Surface Methodology (RSM)
1
2
Designs optimized for fitting response surface models and process optimization. These designs efficiently estimate quadratic effects and interaction terms, making them ideal for modeling non-linear relationships and finding optimal factor settings.
3
4
## Capabilities
5
6
### Box-Behnken Design
7
8
Three-level designs that efficiently estimate quadratic response surfaces using fewer experimental runs than full factorial designs.
9
10
```python { .api }
11
def bbdesign(n, center=None):
12
"""
13
Create a Box-Behnken design
14
15
Parameters:
16
- n: int, number of factors in the design (minimum 3)
17
- center: int, optional, number of center points to include (default 1)
18
19
Returns:
20
- mat: 2d-array, design matrix with levels -1, 0, +1
21
"""
22
```
23
24
**Key Features:**
25
- Uses 3 levels for each factor: -1 (low), 0 (center), +1 (high)
26
- Each factor appears at its extreme levels in combination with center levels of other factors
27
- Efficient for quadratic model fitting with fewer runs than central composite designs
28
- Suitable for 3 or more factors
29
30
**Usage Example:**
31
```python
32
import pyDOE3
33
34
# 3-factor Box-Behnken design
35
design = pyDOE3.bbdesign(3)
36
print(f"Design shape: {design.shape}") # (13, 3) - 12 edge points + 1 center point
37
38
# 4-factor design with 3 center points
39
design = pyDOE3.bbdesign(4, center=3)
40
print(f"Design shape: {design.shape}") # (27, 4) - 24 edge points + 3 center points
41
```
42
43
### Central Composite Design
44
45
Comprehensive response surface designs combining factorial points, star points, and center points for quadratic model estimation.
46
47
```python { .api }
48
def ccdesign(n, center=(4, 4), alpha="orthogonal", face="circumscribed"):
49
"""
50
Create a Central Composite Design (CCD)
51
52
Parameters:
53
- n: int, number of factors in the design
54
- center: tuple of 2 ints, number of center points in (factorial, star) blocks
55
- alpha: str, design property - "orthogonal" or "rotatable"
56
- face: str, star point placement - "circumscribed", "inscribed", or "faced"
57
58
Returns:
59
- mat: 2d-array, design matrix with factorial, star, and center points
60
"""
61
```
62
63
**Alpha Options:**
64
- **"orthogonal"** (default): Minimizes correlation between regression coefficients
65
- **"rotatable"**: Provides constant prediction variance at constant distance from center
66
67
**Face Options:**
68
- **"circumscribed"** (CCC): Star points extend beyond factorial space (5 levels)
69
- **"inscribed"** (CCI): Star points within factorial limits, scaled design (5 levels)
70
- **"faced"** (CCF): Star points at face centers of factorial cube (3 levels)
71
72
**Usage Example:**
73
```python
74
import pyDOE3
75
76
# Standard 3-factor CCD with orthogonal design
77
design = pyDOE3.ccdesign(3)
78
print(f"Design shape: {design.shape}") # (20, 3)
79
80
# Rotatable design with face-centered star points
81
design = pyDOE3.ccdesign(3, alpha="rotatable", face="faced")
82
83
# Custom center points: 2 in factorial block, 6 in star block
84
design = pyDOE3.ccdesign(4, center=(2, 6))
85
```
86
87
### Doehlert Designs
88
89
Uniform space-filling designs for response surface methodology with efficient coverage of spherical experimental regions.
90
91
#### Doehlert Shell Design
92
93
Builds designs by adding concentric shells of points around the center for uniform space coverage.
94
95
```python { .api }
96
def doehlert_shell_design(num_factors, num_center_points=1):
97
"""
98
Generate a Doehlert shell design matrix
99
100
Parameters:
101
- num_factors: int, number of factors (minimum 1)
102
- num_center_points: int, number of center points (default 1)
103
104
Returns:
105
- design: 2d-array, design matrix with N = k² + k + C points
106
where k = factors, C = center points
107
"""
108
```
109
110
#### Doehlert Simplex Design
111
112
Creates simplex-based Doehlert designs for efficient response surface exploration.
113
114
```python { .api }
115
def doehlert_simplex_design(num_factors):
116
"""
117
Generate a Doehlert simplex design matrix
118
119
Parameters:
120
- num_factors: int, number of factors in the design
121
122
Returns:
123
- design: 2d-array, design matrix with k² + k + 1 points
124
where k = number of factors
125
"""
126
```
127
128
**Key Features of Doehlert Designs:**
129
- Uniform distribution in spherical experimental domain
130
- Fewer runs than central composite designs
131
- Good for sequential experimentation and optimization
132
- Not orthogonal or rotatable, but acceptable variance properties
133
134
**Usage Example:**
135
```python
136
import pyDOE3
137
138
# 3-factor Doehlert shell design with 2 center points
139
shell_design = pyDOE3.doehlert_shell_design(3, num_center_points=2)
140
print(f"Shell design shape: {shell_design.shape}") # (13, 3)
141
142
# 4-factor Doehlert simplex design
143
simplex_design = pyDOE3.doehlert_simplex_design(4)
144
print(f"Simplex design shape: {simplex_design.shape}") # (21, 4)
145
```
146
147
## Design Selection Guidelines
148
149
### When to Use Each RSM Design:
150
151
**Box-Behnken Designs:**
152
- **Best for:** 3-5 factors, spherical or cuboidal experimental regions
153
- **Advantages:** Fewer runs than CCD, no extreme combinations, good for constrained regions
154
- **Use when:** Cannot run extreme factor combinations, want 3-level design
155
156
**Central Composite Designs:**
157
- **Best for:** 2-6 factors, comprehensive quadratic modeling
158
- **Advantages:** Most flexible RSM design, well-studied properties, many variants
159
- **Use when:** Need maximum model flexibility, can accommodate 5 levels
160
161
**Doehlert Designs:**
162
- **Best for:** Sequential optimization, spherical experimental regions
163
- **Advantages:** Uniform space-filling, fewer runs, good for augmentation
164
- **Use when:** Space-filling properties important, sequential experimentation
165
166
### RSM Design Comparison:
167
168
| Design Type | Factors | Levels | Runs (3 factors) | Best For |
169
|-------------|---------|--------|------------------|----------|
170
| Box-Behnken | 3+ | 3 | 13-15 | Constrained regions |
171
| Central Composite | 2+ | 3-5 | 15-20 | General RSM |
172
| Doehlert Shell | 1+ | Continuous | 10-13 | Space-filling |
173
| Doehlert Simplex | 1+ | Continuous | 13 | Sequential optimization |
174
175
### Model Fitting Capabilities:
176
177
All RSM designs support fitting second-order polynomial models:
178
179
```
180
y = β₀ + Σβᵢxᵢ + Σβᵢᵢxᵢ² + ΣΣβᵢⱼxᵢxⱼ + ε
181
```
182
183
Where:
184
- β₀: intercept
185
- βᵢ: linear effects
186
- βᵢᵢ: quadratic effects
187
- βᵢⱼ: interaction effects
188
189
## Types
190
191
```python { .api }
192
import numpy as np
193
from typing import Union, Tuple
194
195
# Type aliases for RSM designs
196
DesignMatrix = np.ndarray
197
CenterPoints = Union[int, Tuple[int, int]]
198
AlphaType = str # "orthogonal" or "rotatable"
199
FaceType = str # "circumscribed", "inscribed", or "faced"
200
```