CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pydoe3

Design of experiments library for Python with comprehensive experimental design capabilities

Pending
Overview
Eval results
Files

response-surface.mddocs/

Response Surface Methodology (RSM)

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.

Capabilities

Box-Behnken Design

Three-level designs that efficiently estimate quadratic response surfaces using fewer experimental runs than full factorial designs.

def bbdesign(n, center=None):
    """
    Create a Box-Behnken design
    
    Parameters:
    - n: int, number of factors in the design (minimum 3)
    - center: int, optional, number of center points to include (default 1)
    
    Returns:
    - mat: 2d-array, design matrix with levels -1, 0, +1
    """

Key Features:

  • Uses 3 levels for each factor: -1 (low), 0 (center), +1 (high)
  • Each factor appears at its extreme levels in combination with center levels of other factors
  • Efficient for quadratic model fitting with fewer runs than central composite designs
  • Suitable for 3 or more factors

Usage Example:

import pyDOE3

# 3-factor Box-Behnken design
design = pyDOE3.bbdesign(3)
print(f"Design shape: {design.shape}")  # (13, 3) - 12 edge points + 1 center point

# 4-factor design with 3 center points
design = pyDOE3.bbdesign(4, center=3)
print(f"Design shape: {design.shape}")  # (27, 4) - 24 edge points + 3 center points

Central Composite Design

Comprehensive response surface designs combining factorial points, star points, and center points for quadratic model estimation.

def ccdesign(n, center=(4, 4), alpha="orthogonal", face="circumscribed"):
    """
    Create a Central Composite Design (CCD)
    
    Parameters:
    - n: int, number of factors in the design
    - center: tuple of 2 ints, number of center points in (factorial, star) blocks
    - alpha: str, design property - "orthogonal" or "rotatable"
    - face: str, star point placement - "circumscribed", "inscribed", or "faced"
    
    Returns:
    - mat: 2d-array, design matrix with factorial, star, and center points
    """

Alpha Options:

  • "orthogonal" (default): Minimizes correlation between regression coefficients
  • "rotatable": Provides constant prediction variance at constant distance from center

Face Options:

  • "circumscribed" (CCC): Star points extend beyond factorial space (5 levels)
  • "inscribed" (CCI): Star points within factorial limits, scaled design (5 levels)
  • "faced" (CCF): Star points at face centers of factorial cube (3 levels)

Usage Example:

import pyDOE3

# Standard 3-factor CCD with orthogonal design
design = pyDOE3.ccdesign(3)
print(f"Design shape: {design.shape}")  # (20, 3)

# Rotatable design with face-centered star points
design = pyDOE3.ccdesign(3, alpha="rotatable", face="faced")

# Custom center points: 2 in factorial block, 6 in star block
design = pyDOE3.ccdesign(4, center=(2, 6))

Doehlert Designs

Uniform space-filling designs for response surface methodology with efficient coverage of spherical experimental regions.

Doehlert Shell Design

Builds designs by adding concentric shells of points around the center for uniform space coverage.

def doehlert_shell_design(num_factors, num_center_points=1):
    """
    Generate a Doehlert shell design matrix
    
    Parameters:
    - num_factors: int, number of factors (minimum 1)
    - num_center_points: int, number of center points (default 1)
    
    Returns:
    - design: 2d-array, design matrix with N = k² + k + C points
                       where k = factors, C = center points
    """

Doehlert Simplex Design

Creates simplex-based Doehlert designs for efficient response surface exploration.

def doehlert_simplex_design(num_factors):
    """
    Generate a Doehlert simplex design matrix
    
    Parameters:
    - num_factors: int, number of factors in the design
    
    Returns:
    - design: 2d-array, design matrix with k² + k + 1 points
                       where k = number of factors
    """

Key Features of Doehlert Designs:

  • Uniform distribution in spherical experimental domain
  • Fewer runs than central composite designs
  • Good for sequential experimentation and optimization
  • Not orthogonal or rotatable, but acceptable variance properties

Usage Example:

import pyDOE3

# 3-factor Doehlert shell design with 2 center points
shell_design = pyDOE3.doehlert_shell_design(3, num_center_points=2)
print(f"Shell design shape: {shell_design.shape}")  # (13, 3)

# 4-factor Doehlert simplex design  
simplex_design = pyDOE3.doehlert_simplex_design(4)
print(f"Simplex design shape: {simplex_design.shape}")  # (21, 4)

Design Selection Guidelines

When to Use Each RSM Design:

Box-Behnken Designs:

  • Best for: 3-5 factors, spherical or cuboidal experimental regions
  • Advantages: Fewer runs than CCD, no extreme combinations, good for constrained regions
  • Use when: Cannot run extreme factor combinations, want 3-level design

Central Composite Designs:

  • Best for: 2-6 factors, comprehensive quadratic modeling
  • Advantages: Most flexible RSM design, well-studied properties, many variants
  • Use when: Need maximum model flexibility, can accommodate 5 levels

Doehlert Designs:

  • Best for: Sequential optimization, spherical experimental regions
  • Advantages: Uniform space-filling, fewer runs, good for augmentation
  • Use when: Space-filling properties important, sequential experimentation

RSM Design Comparison:

Design TypeFactorsLevelsRuns (3 factors)Best For
Box-Behnken3+313-15Constrained regions
Central Composite2+3-515-20General RSM
Doehlert Shell1+Continuous10-13Space-filling
Doehlert Simplex1+Continuous13Sequential optimization

Model Fitting Capabilities:

All RSM designs support fitting second-order polynomial models:

y = β₀ + Σβᵢxᵢ + Σβᵢᵢxᵢ² + ΣΣβᵢⱼxᵢxⱼ + ε

Where:

  • β₀: intercept
  • βᵢ: linear effects
  • βᵢᵢ: quadratic effects
  • βᵢⱼ: interaction effects

Types

import numpy as np
from typing import Union, Tuple

# Type aliases for RSM designs
DesignMatrix = np.ndarray
CenterPoints = Union[int, Tuple[int, int]]
AlphaType = str  # "orthogonal" or "rotatable"
FaceType = str   # "circumscribed", "inscribed", or "faced"

Install with Tessl CLI

npx tessl i tessl/pypi-pydoe3

docs

classical-factorial.md

index.md

optimal-design.md

response-surface.md

sampling-randomized.md

taguchi-robust.md

utilities-advanced.md

tile.json