Main Content

mixtureDOE

Design of experiments (DOE) for mixture experiments

Since R2024b

    Description

    A mixtureDOE object contains a design for a mixture experiment. The elements of a point in a mixture design sum to one. Use the properties of a mixtureDOE object to investigate the relative effects of a set of factors on a response variable. The object properties include information about the design, model, and algorithm used to generate the design.

    Creation

    Description

    dmix = mixtureDOE(n) generates a mixture design for n factors and returns the design information in a mixtureDOE object dmix.

    example

    dmix = mixtureDOE(bounds) specifies the number of factors and the bounds for the design points. The elements of bounds must be between 0 and 1.

    example

    dmix = mixtureDOE(___,A,b) specifies linear constraints for the design points using any of the input argument combinations in the previous syntaxes. The linear constraints are given by the formula A * x ≤ b, for a design point x.

    example

    dmix = mixtureDOE(___,Name=Value) specifies additional options using one or more name-value arguments. For example, you can specify the experiment model and the algorithm used to generate the design points.

    example

    Input Arguments

    expand all

    Number of factors in the design, specified as a positive integer.

    Data Types: single | double

    Factor bounds, specified as a 2-by-n matrix, where n is the number of factors in the design. Each column of bounds corresponds to a factor. The first row of bounds contains the lower bounds for the factors, and the second row contains the upper bounds.

    The sum of the lower bounds for a mixture design must be less than or equal to one. The sum of the upper bounds must be greater than or equal to one.

    Example: [0.1 0.1 0; 0.5 0.7 0.7]

    Data Types: single | double

    Linear inequality constraints, specified as an m-by-n matrix, where n is the number of factors in the design and m is the number of constraints. You must also specify b when you specify A.

    When you specify A and b, mixtureDOE uses the following constraints to calculate the design points:

    A(i,1)*Factor1+A(i,2)*Factor2+...+A(i,n)*FactorN≤b(i)

    You can reverse the direction of the sign in the inequality by multiplying the elements of A and b by –1.

    Example: A=[0.3 5 100; 0.1 7 90; 0.25 2 180]

    Data Types: single | double

    Linear inequality constraints, specified as a numeric vector with m elements, where m is the number of constraints. You must also specify A when you specify b.

    When you specify b and A, mixtureDOE uses the following constraints to calculate the design points:

    A(i,1)*Factor1+A(i,2)*Factor2+...+A(i,n)*FactorN≤b(i)

    You can reverse the direction of the sign in the inequality by multiplying the elements of A and b by –1.

    Example: b=[1 5 2]

    Data Types: single | double

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: mixtureDOE(3,A,b,Degree=1,FactorNames=["drug1","drug2","drug3"]) specifies the factor names and degree for a design with three factors and linear constraints.

    Degree of the design, specified as a positive integer. Together with the Method name-value argument, Degree controls the number and location of the design points. The possible values for Degree depend on the value of Method.

    MethodValues for DegreeNumber of Design Points
    "simplex-centroid"1 to n

    i=1d(ni)

    "simplex-lattice"Integers greater than 0

    (n+d1d)

    "extreme-vertices"0 to n – 2mixtureDOE uses the shape of the design space to iteratively calculate design points. The degree of the design specifies the number of iterations in the calculation. For more information, see Method.

    In the above table, n is the number of factors in the design and d is the degree of the design. The default value for Degree is 0 when Method is "extreme-vertices", and n otherwise.

    Example: Degree=5

    Data Types: single | double

    Factor names, specified as a string vector or a cell array of character vectors.

    Example: FactorNames=["compound1","compound2"]

    Data Types: char | string | cell

    Algorithm for generating the mixture design, specified as one of the following values.

    ValueDescription
    "simplex-centroid"

    This method generates design points that contain elements equal to 0, 1, or a fraction. The fraction elements of a point are equal to each other, have numerators equal to 1, and have denominators less than or equal to the number of factors in the model.

    For example, a design with three factors includes the points (1,0,0), (1/2,1/2,0), and (1/3,1/3,1/3).

    "simplex-lattice"

    This method generates design points that contain elements equal to 0, 1, or a fraction. The fraction elements of a point have denominators less than or equal to the number of factors in the model.

    For example, a design with three factors includes the points (1,0,0), (1/2,1/2,0), and (2/3,1/3,0).

    "extreme-vertices"

    This method uses the shape of the design space to generate points for the design. The design space is a polygon whose elements satisfy the bounds and linear constraints for the mixture design.

    The design includes the points at the corners and center of the design space. mixtureDOE adds points to the design depending on its degree.

    • Degree 0 — No additional points are added.

    • Degree dmixtureDOE generates additional points by first taking all possible groupings of two points in the design and then calculating the average of the groupings. The function adds the new points to the design before taking the averages from all possible groupings of three. This process repeats up to groups of d+1 points.

    You can specify the degree d of the design by using the Degree name-value argument.

    When you pass the bounds input argument to mixtureDOE, the supported values for Method depend on the type of bounds you specify.

    • When you specify only lower bounds by setting all upper bounds equal to 1, Method can be any value listed in the table above, and the default value is "simplex-centroid".

    • When you specify only upper bounds by setting all lower bounds equal to 0, the value for Method depends on whether the design has an implied lower bound. The design has an implied lower bound if the sum of all the upper bounds minus the smallest upper bound is less than 1.

      • No implied lower bound — Method can be any value listed in the table above, and the default value is "simplex-centroid".

      • Implied lower bound — Method must be "extreme-vertices".

    The default value for Method is "simplex-centroid" when you specify n, and "extreme-vertices" when you specify A and b.

    Example: Method="simplex-lattice"

    Data Types: char | string

    Experiment model, specified as one of the following values.

    • A character vector or string scalar with the model name.

      ValueModel Description
      "linear"The model contains an intercept and linear term for each factor.
      "constant"The model contains only a constant (intercept) term.
      "interactions"The model contains an intercept, linear term for each factor, and all products of pairs of distinct factors (no squared terms).
      "purequadratic"The model contains an intercept term, and linear and squared terms for each factor.
      "quadratic"The model contains an intercept term, linear and squared terms for each factor, and all products of pairs of distinct factors.
      "scheffe-linear"

      The model contains a linear term for each factor and does not include an intercept term.

      "scheffe-quad"

      The model is given by the formula:

      i=1nbixi+i=1nj<in1bijxixj

      "scheffe-special-cubic"

      The model is given by the formula:

      i=1nbixi+i=1nj<in1bijxixj+i=1nj<in1k<jn2bijkxixjxk

      "polyijk"The model is a polynomial with all terms up to degree i in the first factor, degree j in the second factor, and so on. Specify the maximum degree for each factor by using numerals 0 though 9. The model contains interaction terms, but the degree of each interaction term does not exceed the maximum value of the specified degrees. For example, "poly13" has an intercept and x1, x2, x22, x23, x1*x2, and x1*x22 terms, where x1 and x2 are the first and second factors, respectively.

      In the above table, each xi corresponds to the ith factor in the mixture design, and bi, bij, bijk, and dij are coefficients for the model terms.

    • A character vector or string scalar formula in Wilkinson Notation. The factor names in the formula must be factor names specified by FactorNames.

    • A t-by-n terms matrix, where t is the number of terms and n is the number of factors in the design. A terms matrix is convenient when the number of factors is large and you want to generate the terms programmatically. For more information about terms matrices, see Terms Matrix.

    ModelSpecification does not include the response variable and does not affect the location of the design points.

    Example: ModelSpecification="Factor1+Factor2*Factor3"

    Example: ModelSpecification="scheffe-special-cubic"

    Data Types: single | double | char | string

    Properties

    expand all

    This property is read-only.

    Degree of the design, specified as a positive integer. This property is set by the Degree name-value argument when you create the mixtureDOE object.

    Data Types: single | double

    This property is read-only.

    Generated design points, specified as a table. Each column of Design corresponds to a factor in the design, and each row corresponds to a point.

    Data Types: table

    This property is read-only.

    Factor bounds, specified as a 2-by-n numeric matrix. This property is set by the bounds input argument when you create the mixtureDOE object.

    Data Types: double

    This property is read-only.

    Linear constraints, specified as a numeric matrix.

    This property is set by the A and b input arguments when you create the mixtureDOE object. When you specify A and b, LinearConstraints is [A,b].

    Data Types: single | double

    This property is read-only.

    Algorithm for generating the design, specified as "simplex-centroid", "simplex-lattice", or "extreme-vertices". This property is set by the Method name-value argument when you create the mixtureDOE object.

    Data Types: string

    This property is read-only.

    Experiment model, specified as a formula in Wilkinson Notation. ModelSpecification indicates the model you want to fit with the specified design. ModelSpecification does not include the response variable.

    This property is set by the ModelSpecification name-value argument when you create the mixtureDOE object.

    Data Types: string

    Object Functions

    fitlmFit linear regression model using design points

    Examples

    collapse all

    Generate a mixture design for three factors.

    dmix = mixtureDOE(3)
    dmix = 
      mixtureDOE with properties:
    
                    Design: [7x3 table]
        ModelSpecification: "Factor1 + Factor2 + Factor3"
                    Bounds: [2x3 double]
                    Degree: 3
                    Method: "simplex-centroid"
         LinearConstraints: []
    
    

    dmix is a mixtureDOE object that contains information about the generated mixture design. The output displays the degree of the design, the method used to generate the design points, and the size of the tables describing the design and factors. The output also displays the model for the design, although the model does not affect how the software generates design points.

    Display the design table.

    dmix.Design
    ans=7×3 table
        Factor1    Factor2    Factor3
        _______    _______    _______
    
              1          0          0
              0          1          0
              0          0          1
            0.5        0.5          0
            0.5          0        0.5
              0        0.5        0.5
        0.33333    0.33333    0.33333
    
    

    The design table displays the values for the seven points in the mixture design. The elements of each point sum to one.

    Generate a mixture design and specify bounds for the design points.

    dmix = mixtureDOE([0.01 0.5 0.3; 0.1 0.6 0.7])
    dmix = 
      mixtureDOE with properties:
    
                    Design: [5x3 table]
        ModelSpecification: "Factor1 + Factor2 + Factor3"
                    Bounds: [2x3 double]
                    Degree: 0
                    Method: "extreme-vertices"
         LinearConstraints: []
    
    

    dmix is a mixtureDOE object that contains information about the generated mixture design. Because factor bounds are specified for the design, the function uses the "extreme-vertices" method to generate the design points.

    Generate some response data for the design points.

    rng(0,"twister") %  For reproducibility
    pts = dmix.Design;
    h = height(pts);
    response = 2*pts.Factor1+3*pts.Factor2+pts.Factor3+0.01*randn(h,1);

    Fit a linear model using the fitlm function. Specify the design points in dmix as the predictor data and response as the response data.

    mdl = fitlm(dmix,response)
    mdl = 
    Linear regression model:
        y ~ Factor1 + Factor2 + Factor3
    
    Estimated Coefficients:
                   Estimate       SE       tStat      pValue  
                   ________    ________    ______    _________
    
        Factor1     2.0104      0.18533    10.848    0.0083916
        Factor2     2.9234     0.071299    41.002    0.0005943
        Factor3     1.1118     0.086745    12.817    0.0060326
    
    
    Number of observations: 5, Error degrees of freedom: 2
    Root Mean Squared Error: 0.0156
    

    mdl is a LinearModel object that contains the results of fitting a linear model to the data. The model display includes the model formula, estimated coefficients, and model summary statistics.

    Specify bounds and linear constraints for the design points in a mixture experiment. The sum of the lower bounds for the design points must be less than or equal to 1.

    bounds = [0.1 0.1 0; 0.5 0.7 0.7];
    A = [-0.85 -0.9 -1; 0.85 0.9 1; -0.7 0 -1];
    b = [-0.9; 0.95; -0.4];

    Generate design points that satisfy the bounds and linear constraints.

    dmix = mixtureDOE(bounds,A,b)
    dmix = 
      mixtureDOE with properties:
    
                    Design: [7x3 table]
        ModelSpecification: "Factor1 + Factor2 + Factor3"
                    Bounds: [2x3 double]
                    Degree: 0
                    Method: "extreme-vertices"
         LinearConstraints: [3x4 double]
    
    

    dmix is a mixtureDOE object that contains information about the generated mixture design. The design points satisfy the following system of inequalities:

    -0.85*Factor1-0.9*Factor2-Factor3 ≤ -0.9

    0.85*Factor1+0.9*Factor2+Factor3 ≤ 0.95

    -0.7*Factor1-Factor3 ≤ -0.4

    Inspect the LinearConstraints property of dmix.

    dmix.LinearConstraints
    ans = 3×4
    
       -0.8500   -0.9000   -1.0000   -0.9000
        0.8500    0.9000    1.0000    0.9500
       -0.7000         0   -1.0000   -0.4000
    
    

    The first three columns of the matrix contain the left side of the system of inequalities. The last column contains the right side.

    Generate a mixture design for an experiment that measures the effectiveness of different amounts of three ingredients in a drug. Specify the factor names, method for generating the design points, and degree for the design.

    dmix = mixtureDOE(3,FactorNames=["ingredient1","ingredient2","ingredient3"],Degree=10,Method="simplex-lattice")
    dmix = 
      mixtureDOE with properties:
    
                    Design: [66x3 table]
        ModelSpecification: "ingredient1 + ingredient2 + ingredient3"
                    Bounds: [2x3 double]
                    Degree: 10
                    Method: "simplex-lattice"
         LinearConstraints: []
    
    

    dmix is a mixtureDOE object that contains information about the generated mixture design. The output shows that the function generates the design points using the simplex-lattice method, and the degree of the design is 10. Together with the method, the degree controls how many design points are generated.

    Display the design table.

    dmix.Design
    ans=66×3 table
        ingredient1    ingredient2    ingredient3
        ___________    ___________    ___________
    
              1              0              0    
            0.9            0.1              0    
            0.9              0            0.1    
            0.8            0.2              0    
            0.8            0.1            0.1    
            0.8              0            0.2    
            0.7            0.3              0    
            0.7            0.2            0.1    
            0.7            0.1            0.2    
            0.7              0            0.3    
            0.6            0.4              0    
            0.6            0.3            0.1    
            0.6            0.2            0.2    
            0.6            0.1            0.3    
            0.6              0            0.4    
            0.5            0.5              0    
          ⋮
    
    

    The design table displays the amount of each ingredient to be tested for the 66 design points.

    More About

    expand all

    References

    [1] Cornell, J. A. Experiments with Mixtures: Designs, Models, and the Analysis of Mixture Data. United Kingdom: Wiley, 1990.

    Version History

    Introduced in R2024b