ArticleslgStudy

mathematics

Design matrix

Design matrix is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Design matrix rather than just read about it. In short: In statistics and in particular in regression analysis, a design matrix, also known as model matrix or regressor matrix and often denoted by X, is a matrix of values of explanatory variables of a set of objects. Each row represents an individual object, with the successive columns corresponding to the variables and their specific values for that object.

Key takeaways

  • Design matrix belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Design matrix to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Design matrix from memory before moving on to harder problems.

Reference excerpt

In statistics and in particular in regression analysis, a design matrix, also known as model matrix or regressor matrix and often denoted by X, is a matrix of values of explanatory variables of a set of objects. Each row represents an individual object, with the successive columns corresponding to the variables and their specific values for that object. The design matrix is used in certain statistical models, e.g., the general linear model. It can contain indicator variables (ones and zeros) that indicate group membership in an ANOVA, or it can contain values of continuous variables. The design matrix contains data on the independent variables (also called explanatory variables), in a statistical model that is intended to explain observed data on a response variable (often called a dependent variable). The theory relating to such models uses the design matrix as input to some linear algebra : see for example linear regression. A notable feature of the concept of a design matrix is that it is able to represent a number of different experimental designs and statistical models, e.g., ANOVA, ANCOVA, and linear regression.

Definition The design matrix is defined to be a matrix X such that Xij (the jth column of the ith row of X) represents the value of the jth variable associated with the ith object. A regression model may be represented via matrix multiplication as

y=Xβ+e, where X is the design matrix, β is a vector of the model's coefficients (one for each variable), e is a vector of random errors with mean zero, and y is the vector of predicted outputs for each object.

Size The design matrix has dimension n-by-p, where n is the number of samples observed, and p is the number of variables (features) measured in all samples. In this representation different rows typically represent different repetitions of an experiment, while columns represent different types of data (say, the results from particular probes). For example, suppose an experiment is run where 10 people are pulled off the street and asked 4 questions. The data matrix M would be a 10×4 matrix (meaning 10 rows and 4 columns). The datum in row i and column j of this matrix would be the answer of the i th person to the j th question.

Examples

Arithmetic mean The design matrix for an arithmetic mean is a column vector of ones.

Simple linear regression This section gives an example of simple linear regression—that is, regression with only a single explanatory variable—with seven observations. The seven data points are {yi, xi}, for i = 1, 2, …, 7. The simple linear regression model is

yi=β0+β1xi+εi, where β0 is the y-intercept and β1 is the slope of the regression line. This model can be represented in matrix form as

[y1y2y3y4y5y6y7]=[1x11x21x31x41x51x61x7][β0β1]+[ε1ε2ε3ε4ε5ε6ε7] where the first column of 1s in the design matrix allows estimation of the y-intercept while the second column contains the x-values associated with the corresponding y-values. The matrix whose columns are 1's and x's in this example is the design matrix.

Multiple regression This section contains an example of multiple regression with two covariates (explanatory variables): w and x. Again suppose that the data consist of seven observations, and that for each observed value to be predicted (yi), values wi and xi of the two covariates are also observed. The model to be considered is

yi=β0+β1wi+β2xi+εi This model can be written in matrix terms as

[y1y2y3y4y5y6y7]=[1w1x11w2x21w3x31w4x41w5x51w6x61w7x7][β0β1β2]+[ε1ε2ε3ε4ε5ε6ε7] Here the 7×3 matrix on the right side is the design matrix.

One-way ANOVA (cell means model) This section contains an example with a one-way analysis of variance (ANOVA) with three groups and seven observations. The given data set has the first three observations belonging to the first group, the following two observations belonging to the second group and the final two observations belonging to the third group. If the model to be fit is just the mean of each group, then the model is

yij=μi+εij which can be written

[y1y2y3y4y5y6y7]=[100100100010010001001][μ1μ2μ3]+[ε1ε2ε3ε4ε5ε6ε7] In this model μi represents the mean of the ith group.

One-way ANOVA (offset from reference group) The ANOVA model could be equivalently written as each group parameter τi being an offset from some overall reference. Typically this reference point is taken to be one of the groups under consideration. This makes sense in the context of comparing multiple treatment groups to a control group and the control group is considered the "reference". In this example, group 1 was chosen to be the reference group. As such the model to be fit is

yij=μ+τi+εij with the constraint that τ1 is zero.

[y1y2y3y4y5y6y7]=[100100100110110101101][μτ2τ3]+[ε1ε2ε3ε4ε5ε6ε7] In this model μ is the mean of the reference group and τi is the difference from group i to the reference group. τ1 is not included in the matrix because its difference from the reference group (itself) is necessarily zero.

See also Moment matrix Projection matrix Jacobian matrix and determinant Scatter matrix Gram matrix Vandermonde matrix

References

Further reading Verbeek, Albert (1984). "The Geometry of Model Selection in Regression". In Dijkstra, Theo K. (ed.). Misspecification Analysis. New York: Springer. pp. 20–36. ISBN 0-387-13893-5.

Worked examples

Example 1 — a first encounter with Design matrix

Start with the simplest possible case. Write down what Design matrix claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Design matrix before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Design matrix ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Design matrix

In research
Design matrix appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Design matrix in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Design matrix is common in secondary-school and first-year university syllabi. It links to neighbouring topics Data, Design of experiments, Matrices (mathematics), so understanding it makes those chapters shorter.
In everyday life
Look for Design matrix outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Design matrix” →

How to study Design matrix in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Design matrix means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Design matrix out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Design matrix in simple terms?

In statistics and in particular in regression analysis, a design matrix, also known as model matrix or regressor matrix and often denoted by X, is a matrix of values of explanatory variables of a set of objects. Each row represents an individual object, with the successive columns corresponding to…

Why does Design matrix matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Design matrix?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Design matrix.

Tags

  • Data
  • Design of experiments
  • Matrices (mathematics)
  • Multivariate statistics
  • Regression analysis

Keep exploring