Design of Experiments (DoE) Module
The xpyrment.design.doe package provides industrial-grade structures and algorithms for classical, adaptive, and optimal Design of Experiments (DoE).
📋 Supported DoE Layouts & Classes
The following design templates are dynamically registered and available inside this library:
| Experimental Design | Technical Reference | Key Characteristics & Methodology |
|---|---|---|
| BoxBehnkenDesign | xpyrment.design.doe.BoxBehnkenDesign |
Generates Box-Behnken Designs to estimate non-linear response surfaces in fewer runs. |
| CentralCompositeDesign | xpyrment.design.doe.CentralCompositeDesign |
Generates Central Composite Designs (CCD) for response surface modeling. |
| DOptimalDesign | xpyrment.design.doe.DOptimalDesign |
Optimizes the design matrix determinant |X'X| using coordinate exchange algorithms. |
| DefinitiveScreeningDesign | xpyrment.design.doe.DefinitiveScreeningDesign |
Generates a Definitive Screening Design (DSD) to estimate linear, quadratic, and 2-way terms. |
| EVOPDesign | xpyrment.design.doe.EVOPDesign |
Manages Evolutionary Operation (EVOP) structures for live process improvements. |
| FractionalFactorialDesign | xpyrment.design.doe.FractionalFactorialDesign |
Generates fractional factorial experimental designs, showing resolution and aliasing. |
| FullFactorialDesign | xpyrment.design.doe.FullFactorialDesign |
Generates a full factorial experimental design matrix for all factor combinations. |
| LatinHypercubeDesign | xpyrment.design.doe.LatinHypercubeDesign |
Generates Latin Hypercube Sampling designs for multidimensional factors. |
| MixtureDesign | xpyrment.design.doe.MixtureDesign |
Generates designs for mixture factor spaces where components must sum to 1.0 (e.g., recipe mixes). |
| PlackettBurmanDesign | xpyrment.design.doe.PlackettBurmanDesign |
Generates Plackett-Burman screening design matrices to identify main effects in few runs. |
| SwitchbackDesign | xpyrment.design.doe.SwitchbackDesign |
Generates time/geo crossover switchback experimental designs for marketplace tests. |
| TaguchiDesign | xpyrment.design.doe.TaguchiDesign |
Generates Taguchi orthogonal array designs and S/N ratio mapping specifications. |
📦 Package Reference
doe
Classical Design of Experiments (DoE) generators and optimization engines.
This package houses classical Design of Experiments (DoE) algorithms. It provides a comprehensive set of standardized design matrices for screening active factors, modeling non-linear response surfaces, optimizing mixtures, and scheduling marketplace crossover tests.
Available Designs:
- FullFactorialDesign: Tests all possible level combinations. Orthogonal, estimates all interaction orders.
- FractionalFactorialDesign (\(2^{k-p}\)): Highly efficient screening fractionals with explicit alias and resolution tracking.
- PlackettBurmanDesign: Resolution III screening designs for identifying main effects under extreme trial budgets.
- TaguchiDesign: Balanced Orthogonal Arrays mapped with Signal-to-Noise (S/N) ratios to optimize process robustness.
- DefinitiveScreeningDesign (DSD): Advanced 3-level designs estimating linear, quadratic, and 2-way terms without follow-up runs.
- CentralCompositeDesign (CCD): Standard 5-level Response Surface Methodology (RSM) design (cube + star + center points).
- BoxBehnkenDesign (BBD): Efficient 3-level response surface design avoiding physical or operational corner combinations.
- DOptimalDesign: Computer-guided coordinate exchange optimization to build designs under irregular constraints or budget sizes.
- LatinHypercubeDesign (LHS): Multidimensional space-filling sampling for simulation and black-box computer experiments.
- MixtureDesign: Simplex Lattice and Simplex Centroid formulations where component fractions must sum strictly to 1.0.
- SwitchbackDesign: Temporal crossover designs for multi-region marketplace tests where network spillovers preclude user-splits.
- EVOPDesign: Sequential low-amplitude perturbation loops designed for live, full-scale continuous process optimization.
| MODULE | DESCRIPTION |
|---|---|
base |
Abstract Base Class for classical Design of Experiments (DoE) matrices. |
box_behnken |
Box-Behnken Design (BBD) classical Response Surface Method (RSM) matrices. |
carryover |
Intertemporal Carryover Decompositions in Switchback & Crossover Designs (Block 26). |
ccd |
Central Composite Design (CCD) classical Response Surface Method (RSM) matrices. |
d_optimal |
D-Optimal computer-generated classical Design of Experiments (DoE) matrices. |
dsd |
Definitive Screening Design (DSD) classical Design of Experiments (DoE) matrices. |
evop |
Evolutionary Operation (EVOP) continuous live process optimization matrices. |
fractional_factorial |
Fractional Factorial classical Design of Experiments (DoE) matrices. |
full_factorial |
Full Factorial classical Design of Experiments (DoE) matrices. |
lhs |
Latin Hypercube Sampling (LHS) classical and space-filling Design of Experiments (DoE) matrices. |
mixture |
Mixture-based classical Design of Experiments (DoE) matrices. |
plackett_burman |
Plackett-Burman classical screening Design of Experiments (DoE) matrices. |
switchback |
Switchback and temporal crossover Design of Experiments (DoE) matrices. |
taguchi |
Taguchi robust classical Design of Experiments (DoE) matrices. |
| CLASS | DESCRIPTION |
|---|---|
DesignMatrix |
Abstract base class representing a Design Matrix in Classical Design of Experiments (DoE). |
BoxBehnkenDesign |
Generates Box-Behnken Designs to estimate non-linear response surfaces in fewer runs. |
CentralCompositeDesign |
Generates Central Composite Designs (CCD) for response surface modeling. |
DOptimalDesign |
Optimizes the design matrix determinant |X'X| using coordinate exchange algorithms. |
DefinitiveScreeningDesign |
Generates a Definitive Screening Design (DSD) to estimate linear, quadratic, and 2-way terms. |
EVOPDesign |
Manages Evolutionary Operation (EVOP) structures for live process improvements. |
FractionalFactorialDesign |
Generates fractional factorial experimental designs, showing resolution and aliasing. |
FullFactorialDesign |
Generates a full factorial experimental design matrix for all factor combinations. |
LatinHypercubeDesign |
Generates Latin Hypercube Sampling designs for multidimensional factors. |
MixtureDesign |
Generates designs for mixture factor spaces where components must sum to 1.0 (e.g., recipe mixes). |
PlackettBurmanDesign |
Generates Plackett-Burman screening design matrices to identify main effects in few runs. |
SwitchbackDesign |
Generates time/geo crossover switchback experimental designs for marketplace tests. |
TaguchiDesign |
Generates Taguchi orthogonal array designs and S/N ratio mapping specifications. |
CarryoverDecomposition |
Estimates Direct Treatment Effects (DTE) and decay curves of intertemporal carryover effects. |
DesignMatrix
Bases: ABC
Abstract base class representing a Design Matrix in Classical Design of Experiments (DoE).
A Design Matrix is a structured layout of factor combinations designed to evaluate treatment effects, screening active factors, or modeling multi-factor non-linear responses with the minimal possible experiment run footprint.
Mathematical Context
Let \(k\) be the number of independent factors (variables). A design matrix \(X\) is an \(N \times k\) matrix where each row represents a specific experiment run (a combination of factor levels) and each column represents a factor. In standardized designs, factor levels are typically mapped to coded values: - Continuous factors: mapped to \([-1, 0, +1]\) representing low, medium, and high levels. - Categorical factors: mapped to discrete integer indices.
The primary goal of classical DoE is to construct \(X\) such that the parameter estimation variance of the linear model: $$ Y = X\beta + \varepsilon $$ is minimized, which is equivalent to maximizing the information matrix \(X^T X\).
| ATTRIBUTE | DESCRIPTION |
|---|---|
factors |
A dictionary mapping factor names (str) to their list
of possible levels (floats/integers). For example:
TYPE:
|
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of factor labels to their designated levels.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates and returns the specific classical DoE design matrix. |
Source code in src\xpyrment\design\doe\base.py
generate
abstractmethod
Generates and returns the specific classical DoE design matrix.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame containing the design matrix, where columns represent factors and rows represent specific experimental runs. |
Source code in src\xpyrment\design\doe\base.py
BoxBehnkenDesign
Bases: DesignMatrix
Generates Box-Behnken Designs to estimate non-linear response surfaces in fewer runs.
A Box-Behnken design is a 3-level response surface design (coded as \(-1, 0, +1\)) built by combining fractional factorials with balanced incomplete block designs (BIBDs). Geometrically, instead of placing points at the corners of a multidimensional cube (like CCDs or full factorials), a BBD places points specifically at the midpoints of the edges of the process space, combined with replicated center points.
Safety and Operational Advantages
Because BBD does not contain any "corner points" (combinations where all factors are simultaneously at their extreme high/low levels, such as \((+1, +1, +1)\) or \((-1, -1, -1)\)), it is exceptionally well-suited for physical, chemical, or web experiments where extreme combinations are physically dangerous, environmentally harmful, or likely to trigger catastrophic system errors or service downtime.
Mathematical Sizing and Properties
The total number of required experimental runs \(N\) is: $$ N = 2k(k - 1) + n_c $$ where \(k\) is the number of factors and \(n_c\) is the number of replicated center points (typically \(3\) to \(5\)). For example: - \(k = 3\): \(N = 12 + n_c\) runs (usually \(15\) runs with \(3\) center points, compared to \(15\) for face-centered CCD). - \(k = 4\): \(N = 24 + n_c\) runs (usually \(27\) runs, compared to \(31\) for CCD).
Algorithmic Construction
The design matrix is built by running standard \(2^2\) factorials for pairs of factors while keeping all other factors fixed at their center levels (\(0\)). For \(k=3\) factors: - Block 1: Factors 1 & 2 vary as \(2^2\) factorial (\(\pm 1\)), Factor 3 is fixed at \(0\). - Block 2: Factors 1 & 3 vary as \(2^2\) factorial (\(\pm 1\)), Factor 2 is fixed at \(0\). - Block 3: Factors 2 & 3 vary as \(2^2\) factorial (\(\pm 1\)), Factor 1 is fixed at \(0\). - Center points: All factors are at \(0\).
Pseudocode for the Algorithm
function generate_bbd(factors, num_center_points):
1. Determine k = number of factors.
2. Find all unique pairs (or appropriate balanced blocks) of factors.
3. Initialize design matrix of size (2k(k-1) + num_center_points) x k with zeros.
4. For each block/pair of active factors (i, j):
Create 4 rows representing the standard 2^2 factorial combinations of (+1, -1) for columns i and j.
All other columns in these 4 rows remain 0.
5. Append num_center_points rows consisting entirely of zeros.
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of factor labels to their low/high levels.
TYPE:
|
num_center_points
|
Number of center point replicates to append. Defaults to 3.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates the Box-Behnken Design matrix. |
Source code in src\xpyrment\design\doe\box_behnken.py
generate
Generates the Box-Behnken Design matrix.
Constructs the incomplete block structure in coded space, shuffles columns, appends center trials, and maps back to physical coordinates.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame containing the BBD matrix. |
Source code in src\xpyrment\design\doe\box_behnken.py
CentralCompositeDesign
Bases: DesignMatrix
Generates Central Composite Designs (CCD) for response surface modeling.
A CCD is a 5-level design that extends a standard 2-level factorial design by adding star (axial) points and center points. This allows the estimation of quadratic curvature terms, enabling process optimization.
Mathematical Structure
A CCD with \(k\) factors consists of three distinct parts: 1. Factorial (or Cube) Portion: A standard \(2^k\) (or \(2^{k-p}\) fractional) design with coded levels \([-1, +1]\). This estimates main effects and two-way interactions. (Size: \(N_f = 2^{k-p}\) runs). 2. Axial (or Star) Portion: Runs where all factors except one are set to their center level (\(0\)), and the remaining factor is set to a distance of \(\pm \alpha\). (Size: \(N_a = 2k\) runs). 3. Center Points: Multiple runs where all factors are set to \(0\). This allows estimation of pure experimental error and stabilizes prediction variance at the center of the design space. (Size: \(n_c\) runs).
The total number of runs \(N\) is: $$ N = 2^{k-p} + 2k + n_c $$
Alpha (\(\alpha\)) Parameter Configuration: The distance \(\alpha\) of the axial points determines the geometric shape and properties of the design: - Rotatable: \(\alpha = (N_f)^{1/4}\) (e.g., \(\alpha = 1.414\) for \(k=2\), \(\alpha = 1.682\) for \(k=3\)). Rotatability guarantees that the prediction variance is constant at all points equidistant from the design center. - Face-Centered (CCF): \(\alpha = 1.0\). Star points are placed on the faces of the cube, meaning factors only require 3 levels instead of 5, which is highly practical for many experimental setups. - Orthogonal: \(\alpha\) is mathematically selected so that the quadratic effect estimates are completely uncorrelated with the main effects and other quadratic terms.
Pseudocode for the Algorithm
function generate_ccd(factors, alpha_type, num_center_points):
1. Generate factorial matrix (size N_f x k) using FullFactorial or FractionalFactorial.
Values are in coded space [-1, +1].
2. Compute alpha value based on alpha_type (rotatable, face-centered, orthogonal) and k.
3. Generate axial matrix of size (2k x k):
For each factor i from 1 to k:
Row 1: all zeros except column i which is +alpha.
Row 2: all zeros except column i which is -alpha.
4. Generate center points matrix of size (num_center_points x k), containing all zeros.
5. Stack cube, star, and center matrices (size N x k).
6. Map coded values [-alpha, -1, 0, +1, +alpha] to physical levels in factors.
7. Return DataFrame.
| ATTRIBUTE | DESCRIPTION |
|---|---|
alpha_type |
Geometric configuration for axial star point distance.
Options are
TYPE:
|
Examples:
Example
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of factor labels to their low/high levels.
TYPE:
|
alpha
|
Axial point distance strategy (
TYPE:
|
num_center_points
|
Number of center point replicates to append. Defaults to 4.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates the Central Composite Design matrix. |
Source code in src\xpyrment\design\doe\ccd.py
generate
Generates the Central Composite Design matrix.
Constructs the cube, star, and center blocks in coded space, stacks them, and scales the coordinates back to physical units.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame containing the complete CCD matrix. |
Source code in src\xpyrment\design\doe\ccd.py
DOptimalDesign
Bases: DesignMatrix
Optimizes the design matrix determinant |X'X| using coordinate exchange algorithms.
Unlike classical designs which rely on rigid geometric symmetries, D-optimal designs are algorithmic, computer-generated designs. They are customized to fit a user-specified model (e.g., linear, interactive, or quadratic) and a fixed budget of \(N\) runs, subject to arbitrary boundary constraints.
When to use D-Optimal Designs
- Irregular Design Space: When certain factor combinations are physically impossible or unsafe (e.g., Temperature + Pressure \(\le\) Threshold). This represents a non-rectangular design space.
- Specific Run Constraints: When the budget restricts the experiment to exactly \(N\) runs, which does not match any standard geometric size (such as \(16\) or \(27\)).
- Mix of Qualitative Factors: When factors have irregular, unequal numbers of discrete levels.
Mathematical Criterion
Let \(X\) be the \(N \times p\) model design matrix (where columns include main effects, interactions, and quadratic terms). The information matrix is \(M = X^T X\). D-optimality maximizes the determinant of the information matrix: $$ \max_{X} \left| X^T X \right| $$ Maximizing this determinant is mathematically equivalent to minimizing the volume of the joint confidence ellipsoid for the estimated model parameters \(\beta\). The D-efficiency of a design is: $$ D_{\text{eff}} = 100 \times \left( \frac{\left| X^T X \right|^{1/p}}{N} \right) $$
Coordinate Exchange Algorithm (Meyer & Nachtsheim, 1995): To find the optimal design without evaluating all combinations (which is NP-hard): 1. Create an initial design matrix \(X^{(0)}\) of size \(N \times k\) by randomly sampling from candidate levels. 2. Loop through each cell \(x_{i, j}\) (row \(i\), factor \(j\)) in the matrix: - Replace \(x_{i, j}\) with each possible candidate level. - For each replacement, compute the new determinant \(|X^T X|\) using rank-one update formulas (Sherman-Morrison-Woodbury theorem) to avoid expensive \(O(p^3)\) matrix inversion. - Keep the level that maximizes the determinant. 3. Repeat coordinate sweeps across the matrix until a full sweep results in no determinant improvements. 4. Run this process from multiple (e.g., 20 to 50) random initial starts to prevent convergence into local optima, selecting the global maximum found.
| ATTRIBUTE | DESCRIPTION |
|---|---|
num_runs |
The exact target trial budget (number of runs in the final matrix).
TYPE:
|
Examples:
Example
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of factor labels to their candidate levels.
TYPE:
|
num_runs
|
The target budget of trials.
TYPE:
|
seed
|
Random seed for reproducibility. Defaults to 42.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates the D-Optimal design matrix. |
Source code in src\xpyrment\design\doe\d_optimal.py
generate
Generates the D-Optimal design matrix.
Runs the coordinate exchange optimization loop from multiple random starts, applying boundary constraints, and maps the best output to physical units.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame containing the optimal design matrix. |
Source code in src\xpyrment\design\doe\d_optimal.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |
DefinitiveScreeningDesign
Bases: DesignMatrix
Generates a Definitive Screening Design (DSD) to estimate linear, quadratic, and 2-way terms.
DSDs are specialized 3-level designs (coded as \(-1, 0, +1\)). Unlike traditional screening designs (which can only estimate linear main effects), a DSD is designed to screen active factors while simultaneously modeling curvilinear (quadratic) responses and 2-way interactions without requiring a subsequent follow-up Response Surface Method (RSM) design.
Mathematical Properties and Sizing
Let \(k\) be the number of factors. The minimum required number of experimental runs \(N\) is: - For even \(k\): \(N = 2k + 1\) runs. - For odd \(k\): \(N = 2k + 3\) runs (which represents the next even number of factors plus 3).
The structural properties of the resulting design matrix \(X\) include: 1. Orthogonality of Main Effects: All main effects are mutually orthogonal and completely unconfounded with other main effects, two-way interactions, and quadratic effects. 2. Weak Confounding of Quadratic Terms: Quadratic terms are not confounded with main effects, and are only partially/weakly confounded with two-way interactions. 3. No Co-aliased 2-Way Interactions: No two-way interaction is completely aliased (confounded) with any other two-way interaction.
Conference Matrix Generative Algorithm
The core of a DSD is constructed using mathematical Conference Matrices (\(C\)).
A conference matrix \(C_m\) of order \(m\) is an \(m \times m\) matrix with diagonal entries equal to \(0\)
and off-diagonal entries equal to \(\pm 1\), satisfying:
$$
C_m^T C_m = (m - 1) I_m
$$
To generate a DSD for \(k\) factors:
1. Generate a conference matrix of appropriate size.
2. For each row \(r_i\) in the conference matrix, create a "folded-over" pair of rows:
$$
r_i \quad \text{and} \quad -r_i
$$
This guarantees that the columns have an average value of exactly zero, centering the design.
3. Append a final "center point" run consisting entirely of zeros:
$$
[0, 0, \dots, 0]
$$
4. This results in \(2k + 1\) (or \(2k + 3\)) runs in coded \([-1, 0, +1]\) space.
5. Map these levels back to physical levels (low, medium, high) in factors.
Pseudocode for the Algorithm
function generate_dsd(factors):
1. Determine k = number of factors.
2. Select order m of conference matrix (m = k if k even, m = k + 1 if k odd).
3. Load/generate conference matrix C of order m.
4. Create matrix D by stacking [C] and [-C] (size 2m x m).
5. Append row of all zeros (size (2m + 1) x m).
6. If k was odd, truncate the last column of the matrix to yield a (2k + 3) x k matrix.
7. Scale coded values [-1, 0, +1] to the physical factor levels.
8. Return DataFrame.
Examples:
Example
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of factor labels to their designated low, mid, and high levels.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates the Definitive Screening Design matrix. |
Source code in src\xpyrment\design\doe\dsd.py
generate
Generates the Definitive Screening Design matrix.
Looks up or constructs the base conference matrix, performs folding operations, appends the center point, and scales the coded levels.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame containing the DSD matrix. |
Source code in src\xpyrment\design\doe\dsd.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
EVOPDesign
Bases: DesignMatrix
Manages Evolutionary Operation (EVOP) structures for live process improvements.
EVOP is based on the philosophy that a live process should not only produce a product (revenue), but should also generate valuable information on how to improve itself. To avoid producing off-specification output or causing system instability, EVOP introduces extremely small, low-amplitude perturbations to factors around the current operating center.
Operational Cycles and Phases
- Low-Amplitude Perturbations: Factor levels (typically in a simple \(2^2\) or \(2^3\) factorial layout with a center point) are set extremely close to the current operating standard.
- Sequential Replication (Cycles): Because the factor changes are small, the signal-to-noise ratio is very low. The same factor combinations are repeated sequentially over multiple "Cycles" (\(C_1, C_2, \dots\)). As cycles accumulate, statistical standard errors decrease (\(SE \propto 1/\sqrt{N}\)), and the treatment effects gradually emerge from the background noise.
- Evolutionary Steps (Phases): Once an effect or interaction is shown to be statistically significant and beneficial, the operating center is shifted to the new optimal combination. This starts a new "Phase" of the study, and the perturbation pattern is repeated around the new center.
Mathematical Representation
For a 2-factor EVOP with current operating settings \((X_{1, \text{opt}}, X_{2, \text{opt}})\): - Center Point (0): \((X_{1, \text{opt}}, X_{2, \text{opt}})\) - Coded run (-1, -1): \((X_{1, \text{opt}} - \delta_1, X_{2, \text{opt}} - \delta_2)\) - Coded run (+1, -1): \((X_{1, \text{opt}} + \delta_1, X_{2, \text{opt}} - \delta_2)\) - Coded run (-1, +1): \((X_{1, \text{opt}} - \delta_1, X_{2, \text{opt}} + \delta_2)\) - Coded run (+1, +1): \((X_{1, \text{opt}} + \delta_1, X_{2, \text{opt}} + \delta_2)\) where \(\delta_j\) is a very small, non-disruptive increment.
Pseudocode for the Algorithm
function generate_evop_matrix(center_settings, delta_increments):
1. Form standard 2^k factorial + center run in coded space [-1, 0, +1].
2. For each factor column j:
Map 0 -> center_settings[j]
Map -1 -> center_settings[j] - delta_increments[j]
Map +1 -> center_settings[j] + delta_increments[j]
3. Structure the output DataFrame with additional columns:
"Cycle": tracking the sequence index of the replication.
"Phase": tracking the active optimization phase.
4. Return DataFrame.
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of factor labels to their designated levels.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates the Evolutionary Operation (EVOP) factor matrix. |
Source code in src\xpyrment\design\doe\base.py
generate
generate(
center_settings: dict = None,
deltas: dict = None,
num_cycles: int = 3,
phase: int = 1,
) -> DataFrame
Generates the Evolutionary Operation (EVOP) factor matrix.
Applies tiny operational increments around current baseline settings, constructs the replicated factorial cycle matrix, and returns the result.
| PARAMETER | DESCRIPTION |
|---|---|
center_settings
|
Target operating center values for each factor.
TYPE:
|
deltas
|
Tiny perturbation step increments for each factor.
TYPE:
|
num_cycles
|
Number of cycles (replications) to run. Defaults to 3.
TYPE:
|
phase
|
Studying phase identifier. Defaults to 1.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame containing the EVOP design matrix. |
Source code in src\xpyrment\design\doe\evop.py
FractionalFactorialDesign
Bases: DesignMatrix
Generates fractional factorial experimental designs, showing resolution and aliasing.
In a fractional factorial design (represented as \(2^{k-p}\)), only a subset of size \(2^{k-p}\) of the \(2^k\) full combinations is run, where \(p\) is the number of "generators" used to define columns for fractional factors. This is highly efficient for screening a large number of factors using a small number of runs, under the Sparsity of Effects principle (which states that system response is primarily governed by main effects and low-order interactions).
Mathematical Background and Sizing
- Coded Notation: Let there be \(k\) factors. We select a subset of \(k - p\) "base factors" which are run as a standard \(2^{k-p}\) full factorial design.
- Generators: The remaining \(p\) factors are generated by multiplying columns of the base factors. For example, in a \(2^{5-1}\) design (\(k=5, p=1\)), the fifth factor \(E\) can be generated as: $$ E = A \times B \times C \times D \quad (\text{or } E = ABCD) $$ The defining relation of the design is then: $$ I = ABCDE $$
- Resolution:
- Resolution III: Main effects are confounded with 2-way interactions. (e.g., \(I = ABD\)).
- Resolution IV: Main effects are confounded with 3-way interactions, but 2-way interactions are confounded with other 2-way interactions. (e.g., \(I = ABCD\)).
- Resolution V: Main effects are confounded with 4-way interactions, and 2-way interactions are confounded with 3-way interactions. No main effect or 2-way interaction is confounded with any other main effect or 2-way interaction. (e.g., \(I = ABCDE\)).
Confounding/Alias Structure Algorithm: To calculate the alias structure, we multiply every effect column by the defining relation. Since \(A \times A = I\) (identity): $$ A \times I = A \times ABCDE \implies A = BCDE $$ Thus, the estimate of factor \(A\)'s effect is confounded with the 4-way interaction \(BCDE\).
Pseudocode for the Algorithm
function generate_fractional_factorial(factors, generator_string):
1. Parse generator_string (e.g., "E = ABCD, F = BCD").
2. Identify base factors (e.g., A, B, C, D).
3. Generate full factorial matrix of size 2^(k-p) for base factors.
Map levels to coded values [-1, +1].
4. For each generator "X = Y1*Y2*...":
Create column X by taking the row-wise product of columns Y1, Y2, ...
5. Re-scale coded [-1, +1] columns back to the actual factor level physical units.
6. Return DataFrame.
| ATTRIBUTE | DESCRIPTION |
|---|---|
generator_string |
Defining relation generator string, such as
TYPE:
|
Examples:
Example
>>> # Planning a 2^{5-1} resolution V design
>>> # Base factors are A, B, C, D. E is generated as ABCD.
>>> factors = {
... "A": [10, 20], "B": [0, 1], "C": [-1, 1], "D": [5, 10], "E": [100, 200]
... }
>>> design = FractionalFactorialDesign(factors, generator_string="E = ABCD")
>>> # In the generated DataFrame, we will have 2^(5-1) = 16 runs instead of 32.
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of factor labels to their designated low/high levels.
TYPE:
|
generator_string
|
Design generator equations, e.g.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates the fractional factorial design matrix. |
Source code in src\xpyrment\design\doe\fractional_factorial.py
generate
Generates the fractional factorial design matrix.
Processes the generator string to construct base columns and applies multiplicative transformations to compute fractional factors.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame containing the fractional factorial design matrix, using physical factor level units. |
Source code in src\xpyrment\design\doe\fractional_factorial.py
FullFactorialDesign
Bases: DesignMatrix
Generates a full factorial experimental design matrix for all factor combinations.
In a full factorial design, the experiment runs encompass all combinations of levels across all factors. This design is highly informative because it enables the orthogonal estimation of: - Main Effects: The individual impact of changing each factor independently. - Interaction Effects: How the impact of one factor depends on the level of other factors, extending to 2-way, 3-way, ..., and \(k\)-way interactions.
Mathematical Context
Let \(k\) be the number of independent factors, and let \(l_i\) be the number of levels for factor \(i\) (\(i \in \{1, 2, \dots, k\}\)). The total number of required experimental runs \(N\) is: $$ N = \prod_{i=1}^{k} l_i $$ For symmetric \(2^k\) designs (where every factor has exactly 2 levels: e.g., low and high): $$ N = 2^k $$ While extremely thorough, full factorial designs suffer from the "curse of dimensionality", where \(N\) grows exponentially as more factors are added, making them economically or temporally unfeasible for large numbers of factors (where fractional designs are preferred).
Examples:
Example
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of factor labels to their designated levels.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates the full factorial design matrix. |
Source code in src\xpyrment\design\doe\base.py
generate
Generates the full factorial design matrix.
Utilizes itertools.product to compute the Cartesian product of all factor levels,
creating an \(N \times k\) DataFrame.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame representing the full factorial design matrix. |
Source code in src\xpyrment\design\doe\full_factorial.py
LatinHypercubeDesign
Bases: DesignMatrix
Generates Latin Hypercube Sampling designs for multidimensional factors.
LHS is a generalization of a Latin Square to an arbitrary number of dimensions. It ensures that the ensemble of random samples is distributed evenly across the entire multi-dimensional space, preventing the accidental clustering of points that can occur with simple random sampling.
Mathematical Definition and Properties
Let \(N\) be the number of target samples (runs) and \(k\) be the number of factors. A Latin Hypercube design is represented by an \(N \times k\) matrix where: 1. Projection of the \(N\) sample points onto any single factor dimension yields exactly one sample in each of \(N\) equally probable intervals. 2. Specifically, the range of each factor is divided into \(N\) non-overlapping intervals of equal probability: $$ I_j = \left[ \frac{j-1}{N}, \frac{j}{N} \right] \quad \text{for } j \in {1, 2, \dots, N} $$ 3. Within each interval \(I_j\), a point is sampled (either at the midpoint or randomly): $$ x_j = \frac{j-1 + U_j}{N} $$ where \(U_j \sim \text{Uniform}(0, 1)\) is a random noise variable. 4. The sampled values for the \(k\) dimensions are paired using independent, random permutations of the set \(\{1, 2, \dots, N\}\) for each column.
Maximin LHS Space-Filling Variant
Standard random LHS can still yield sample points clustered close together in multidimensional space. To prevent this, Maximin LHS optimizes the permutations to maximize the minimum Euclidean distance between any two sample points: $$ \max_{\Pi} \min_{a \neq b} \lVert x_a - x_b \rVert_2 $$ This forces the points to spread out as far as possible, filling the multidimensional space uniformly.
Pseudocode for the Algorithm
function generate_lhs(factors, N):
1. Determine k = number of factors.
2. Initialize N x k matrix LHS_coded.
3. For each column j from 1 to k:
a. Create array of interval indices: [1, 2, ..., N].
b. Shuffle the interval indices randomly (permutation).
c. For each row i:
Draw random uniform noise U ~ Uniform(0, 1).
Compute coded value: cell = (shuffled_index[i] - 1 + U) / N.
LHS_coded[i, j] = cell.
4. If Maximin optimization is enabled:
Iterate permutations to maximize min_distance(row_a, row_b).
5. Map the coded values in [0, 1] to the physical bounds specified in factors.
6. Return DataFrame.
| ATTRIBUTE | DESCRIPTION |
|---|---|
num_samples |
The exact number of samples (runs) to draw.
TYPE:
|
Examples:
Example
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of factor labels to their lower and upper physical boundaries.
TYPE:
|
num_samples
|
The target number of samples.
TYPE:
|
seed
|
Random seed for reproducibility. Defaults to 42.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates the Latin Hypercube design matrix. |
Source code in src\xpyrment\design\doe\lhs.py
generate
Generates the Latin Hypercube design matrix.
Partitions interval ranges, draws independent uniform perturbations, shuffles columns, optionally optimizes minimum spacing, and maps results to physical bounds.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame containing the LHS matrix. |
Source code in src\xpyrment\design\doe\lhs.py
MixtureDesign
Bases: DesignMatrix
Generates designs for mixture factor spaces where components must sum to 1.0 (e.g., recipe mixes).
In mixture experiments, the independent variables are components of a blend. Changing the proportion of one ingredient automatically forces the proportions of other ingredients to change.
Mathematical Representation and Simplex Constraints
Let \(k\) be the number of components in the mixture, and let \(x_i\) be the proportion of component \(i\) (\(i \in \{1, 2, \dots, k\}\)). The design space is subject to the following strict constraints: $$ \sum_{i=1}^{k} x_i = 1.0 \quad \text{and} \quad 0 \le x_i \le 1.0 \ \ \forall \ i $$ This constraint restricts the geometric region of interest to a \((k-1)\)-dimensional simplex (e.g., an equilateral triangle for \(k=3\), or a regular tetrahedron for \(k=4\)).
Standard Classical Designs
- Simplex Lattice Design (denoted \(\{k, m\}\)): Each component takes \(m + 1\) equally spaced values between \(0\) and \(1\): $$ x_i \in \left{ 0, \frac{1}{m}, \frac{2}{m}, \dots, 1 \right} $$ The runs consist of all possible combinations of these levels that sum to exactly \(1.0\). The total number of runs \(N\) is: $$ N = \frac{(k + m - 1)!}{m!(k - 1)!} $$
- Simplex Centroid Design: Consists of runs at pure components (one factor is \(1.0\), others \(0\)), binary blends (two factors at \(0.5\), others \(0\)), ternary blends (three factors at \(1/3\), others \(0\)), and so on, up to the overall centroid blend where all \(k\) factors are equal to \(1/k\). The total number of runs \(N\) is: $$ N = 2^k - 1 $$
Pseudocode for Simplex Lattice Algorithm:
function generate_simplex_lattice(k, m):
1. Generate all compositions of integer m into k parts:
Find all non-negative integer vectors [v1, v2, ..., vk] such that sum(vi) = m.
2. For each composition, compute the fractional proportions:
x_i = v_i / m.
3. Bind x_i columns to the physical factors.
4. Return DataFrame.
Examples:
Example
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of ingredient factor labels to their low/high levels (usually [0.0, 1.0]).
TYPE:
|
m
|
Simplex Lattice division parameter. Defaults to 2.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates the Mixture Design matrix. |
Source code in src\xpyrment\design\doe\mixture.py
generate
Generates the Mixture Design matrix.
Constructs simplex coordinates using either Simplex Lattice or Simplex Centroid algorithms, verifies the summing constraint, and binds to physical factors.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame containing the Mixture design matrix. |
Source code in src\xpyrment\design\doe\mixture.py
PlackettBurmanDesign
Bases: DesignMatrix
Generates Plackett-Burman screening design matrices to identify main effects in few runs.
Plackett-Burman designs are classical Resolution III fractionals where the number of runs \(N\) is a multiple of 4 (typically \(N = 12, 16, 20, 24, 28, 36, 40, \dots\)). They allow screening of up to \(k = N - 1\) factors in \(N\) trials.
Mathematical Context and Confounding
Unlike standard \(2^{k-p}\) fractional factorials where main effects are completely aliased with specific two-way interactions, Plackett-Burman designs exhibit a complex confounding structure where each main effect is partially confounded (aliased) with multiple two-way interactions. For example, in an \(N=12\) design, every main effect is aliased with 45 distinct two-way interactions with fractional coefficient weights of \(\pm 1/3\). This properties makes Plackett-Burman designs highly robust screening tools if the Sparsity of Effects principle holds, as interaction effects are diluted and do not fully bias any single main effect estimate.
Coded Generative Algorithm
Plackett-Burman designs are built by taking a specialized "first generator row" of signs (\(+\) and \(-\)),
cyclically shifting it to form the first \(N - 1\) columns, and then appending a final row of all minuses (\(-1\)).
Standard generator sequences for different run sizes (\(N\)) include:
- \(N = 8\): + + + - + - -
- \(N = 12\): + + - + + + - - - + -
- \(N = 16\): + + + + - + - + + - - + - - -
- \(N = 20\): + + - - + + - - + + - - + + - - + + -
Pseudocode for the Algorithm
function generate_plackett_burman(factors, N):
1. Select first generator row of length N - 1 based on run size N.
(e.g., for N=12: [1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1]).
2. Construct (N - 1) x (N - 1) matrix by cyclically shifting the generator row.
3. Append a final row of N - 1 elements, all equal to -1.
Now we have an N x (N - 1) design matrix in coded [-1, +1] format.
4. Truncate the columns to match the actual number of factors requested.
5. Map the coded values back to the actual factor levels.
6. Return DataFrame.
Examples:
Example
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of factor labels to their designated levels.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates the Plackett-Burman design matrix. |
Source code in src\xpyrment\design\doe\base.py
generate
Generates the Plackett-Burman design matrix.
Builds the cyclic shifts based on standard generator sequences, truncates to match the factors dictionary, and scales back to the actual levels.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame containing the design matrix. |
Source code in src\xpyrment\design\doe\plackett_burman.py
SwitchbackDesign
Bases: DesignMatrix
Generates time/geo crossover switchback experimental designs for marketplace tests.
In standard user-split A/B testing, a treatment that increases supply utilization in a local market indirectly deprives the control group of supply (market interference/spillover bias). This violates the Stable Unit Treatment Value Assumption (SUTVA). Switchback designs resolve this by randomizing the entire marketplace over sequential time blocks.
Temporal Crossover and Balance
The marketplace switches back and forth between control and treatment configurations over a series of discrete time blocks of length \(W\) (e.g., 2 hours). $$ \text{Schedule}: W_1 \to \text{Control}, \ W_2 \to \text{Treatment}, \ W_3 \to \text{Treatment}, \ \dots $$ To prevent systematic time-of-day or day-of-week biases (e.g., treatment always running during rush hour), the assignments are structured using balanced crossover patterns: - Markovian Transitions: Ensuring equal transition probabilities between states (\(C \to T\), \(T \to C\), \(C \to C\), \(T \to T\)) to model and subtract temporal carryover. - Multi-region Crossover: If multiple geographic markets are available, we cross them over simultaneously: $$ \text{Region A}: C \to T \quad \text{vs.} \quad \text{Region B}: T \to C $$
Carryover and Washout Periods: A major challenge in switchbacks is the carryover effect — supply/demand states from a treatment period spilling over into the subsequent control period. To solve this, the algorithm configures a "washout" parameter \(\omega\) (e.g., 30 minutes) at the start of each window. Data collected during the first \(\omega\) minutes of each transition is excluded from statistical evaluation.
Pseudocode for the Algorithm
function generate_switchback_schedule(regions, start_time, end_time, window_hours, washout_minutes):
1. Partition the experimental timeframe [start_time, end_time] into N discrete blocks of size window_hours.
2. For each region:
Generate a balanced crossover assignment sequence (using Latin Squares or randomized block schedules).
3. For each block in the schedule:
Mark the first washout_minutes as "washout_active = True" (telemetry exclusion flag).
Assign the active variant label.
4. Compile regional time-block rows into a structured DataFrame.
5. Return DataFrame.
| ATTRIBUTE | DESCRIPTION |
|---|---|
unit_window_hours |
The duration in hours of each discrete experimental block. Defaults to 2.
TYPE:
|
Examples:
Example
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of the market-level factor to its variant options.
TYPE:
|
unit_window_hours
|
Duration of each switch window in hours. Defaults to 2.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates the Switchback design schedule. |
optimize_washout |
Evaluates AR(p) error structures across candidate washout times to stabilize covariance. |
Source code in src\xpyrment\design\doe\switchback.py
generate
Generates the Switchback design schedule.
Divides the temporal horizons into balanced blocks, schedules treatment crossovers, marks washout segments, and outputs the operational assignment ledger.
| PARAMETER | DESCRIPTION |
|---|---|
regions
|
List of geographic or logical market regions to crossover.
Defaults to
TYPE:
|
num_periods
|
Total number of sequential time block windows. Defaults to 12.
TYPE:
|
washout_minutes
|
Transition period length to discard temporal carryover. Defaults to 30.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame representing the temporal switchback schedule. |
Source code in src\xpyrment\design\doe\switchback.py
optimize_washout
optimize_washout(
df: DataFrame,
time_col: str,
metric_col: str,
treatment_col: str,
max_p: int = 3,
stability_threshold: float = 0.05,
) -> int
Evaluates AR(p) error structures across candidate washout times to stabilize covariance.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Experimental telemetry dataset.
TYPE:
|
time_col
|
Minute/second elapsed column since block transition.
TYPE:
|
metric_col
|
Target evaluation metric.
TYPE:
|
treatment_col
|
Column indicating binary/categorical treatment assignment.
TYPE:
|
max_p
|
Maximum autoregressive lag order. Defaults to 3.
TYPE:
|
stability_threshold
|
Variance/autocorrelation index threshold representing stability. Defaults to 0.05.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
The optimal washout period in minutes.
TYPE:
|
Source code in src\xpyrment\design\doe\switchback.py
TaguchiDesign
Bases: DesignMatrix
Generates Taguchi orthogonal array designs and S/N ratio mapping specifications.
Taguchi designs leverage specialized, highly balanced fractional factorials (Orthogonal Arrays, denoted as \(L_4, L_8, L_9, L_{12}, L_{16}, L_{18}, L_{27}\), etc.) to evaluate factor effects on both the mean and variability of responses. Rather than optimizing the mean alone, Taguchi methods prioritize "robustness" — making the system insensitive to uncontrollable "noise factors".
Mathematical Specifications for Signal-to-Noise (\(S/N\), denoted \(\eta\)) Ratios
Taguchi methods convert multiple experimental response replicates \(y_1, y_2, \dots, y_n\) at each run into an \(S/N\) ratio (\(\eta\) in decibels) depending on the optimization objective:
- Smaller-The-Better (e.g., latency, defects, material wear): $$ \eta = -10 \log_{10} \left( \frac{1}{n} \sum_{i=1}^{n} y_i^2 \right) $$
- Larger-The-Better (e.g., conversion rate, user engagement, revenue): $$ \eta = -10 \log_{10} \left( \frac{1}{n} \sum_{i=1}^{n} \frac{1}{y_i^2} \right) $$
- Nominal-The-Best (e.g., precise target dimensions, exact fluid viscosity): $$ \eta = 10 \log_{10} \left( \frac{\bar{y}^2}{s^2} \right) $$ where \(\bar{y}\) is the sample mean and \(s^2\) is the sample variance across the replicates.
Orthogonal Array Database Selection Algorithm
- The user requests a specific array (e.g., \(L_9\), which supports up to 4 factors with 3 levels each).
- The algorithm maps the requested physical factors to columns in the standard predefined \(L_9\) template:
| Run | Col 1 (Coded) | Col 2 (Coded) | Col 3 (Coded) | Col 4 (Coded) |
|---|---|---|---|---|
| 1 | 1 | 1 | 1 | 1 |
| 2 | 1 | 2 | 2 | 2 |
| 3 | 1 | 3 | 3 | 3 |
| 4 | 2 | 1 | 2 | 3 |
| 5 | 2 | 2 | 3 | 1 |
| 6 | 2 | 3 | 1 | 2 |
| 7 | 3 | 1 | 3 | 2 |
| 8 | 3 | 2 | 1 | 3 |
| 9 | 3 | 3 | 2 | 1 |
These levels are mapped back to the physical factor levels provided in factors.
| ATTRIBUTE | DESCRIPTION |
|---|---|
array_name |
The name of the target Taguchi Orthogonal Array (e.g.,
TYPE:
|
Examples:
Example
>>> # Selecting an L9 array (supports up to 4 factors at 3 levels)
>>> factors = {
... "temperature": [100, 150, 200],
... "pressure": [1.0, 1.5, 2.0],
... "catalyst": [0.01, 0.05, 0.10]
... }
>>> design = TaguchiDesign(factors, array_name="L9")
>>> # Generated matrix will contain exactly 9 balanced runs.
| PARAMETER | DESCRIPTION |
|---|---|
factors
|
Mapping of factor labels to their lists of levels.
TYPE:
|
array_name
|
The name of the target orthogonal array, e.g.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
generate |
Generates the Taguchi Orthogonal Array design matrix. |
Source code in src\xpyrment\design\doe\taguchi.py
generate
Generates the Taguchi Orthogonal Array design matrix.
Looks up the standard template corresponding to array_name, binds the active
factors to template columns, and maps them to physical levels.
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
pd.DataFrame: A pandas DataFrame containing the Taguchi design matrix. |
Source code in src\xpyrment\design\doe\taguchi.py
CarryoverDecomposition
Estimates Direct Treatment Effects (DTE) and decay curves of intertemporal carryover effects.
Fits the model
Y_t = beta_0 + beta_direct * T_t + sum_{k=1}^K beta_carryover_k * T_{t-k} * exp(-lambda_k * dt_t) + epsilon_t
Using an optimized coordinate grid search over the exponential decay parameters lambda.
| PARAMETER | DESCRIPTION |
|---|---|
l2_penalty
|
L2 regularization parameter for OLS stability. Defaults to 1e-5.
TYPE:
|
max_lags
|
Maximum number of historical lags to consider. Defaults to 1.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
fit |
Fits the carryover decomposition model with multi-stage lags. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
summary |
Returns a summary dictionary of the fitted carryover effects.
TYPE:
|
Source code in src\xpyrment\design\doe\carryover.py
summary
property
Returns a summary dictionary of the fitted carryover effects.
fit
fit(
outcomes: ndarray, treatments: ndarray, times: ndarray
) -> CarryoverDecomposition
Fits the carryover decomposition model with multi-stage lags.
| PARAMETER | DESCRIPTION |
|---|---|
outcomes
|
Target outcome series of shape (N,). Must be sorted chronologically.
TYPE:
|
treatments
|
Binary treatment series of shape (N,) (0 = control, 1 = treated).
TYPE:
|
times
|
Chronological timestamps of shape (N,).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CarryoverDecomposition
|
Fitted decomposer.
TYPE:
|
Source code in src\xpyrment\design\doe\carryover.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |