Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Design matrix
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Matrix of values of explanatory variables}} 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 (mathematics)|matrix]] of values of [[explanatory variable]]s 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 model]]s, e.g., the [[general linear model]].<ref>{{cite book |last=Everitt |first=B. S. |year=2002 |title=Cambridge Dictionary of Statistics |edition=2nd |location=Cambridge, UK |publisher=Cambridge University Press |isbn=0-521-81099-X }}</ref><ref>{{cite book |last1=Box |first1=G. E. P. |author-link=George E. P. Box|author2-link=George Tiao |last2=Tiao |first2=G. C. |year=1992 |orig-year=1973 |title=Bayesian Inference in Statistical Analysis |location=New York |publisher=John Wiley and Sons |isbn=0-471-57428-7 }} (Section 8.1.1)</ref><ref>{{cite book |last=Timm |first=Neil H. |title=Applied Multivariate Analysis |publisher=Springer Science & Business Media |year=2007 |page=107 |isbn=9780387227719 |url=https://books.google.com/books?id=vtiyg6fnnskC&pg=PA107 }}</ref> It can contain [[indicator variable]]s (ones and zeros) that indicate group membership in an [[ANOVA]], or it can contain values of [[continuous variable]]s. The design matrix contains data on the [[independent variable]]s (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 design]]s and statistical models, e.g., [[ANOVA]], [[ANCOVA]], and linear regression.{{citation needed|date=April 2013}} ==Definition== The design matrix is defined to be a matrix <math>X</math> such that <math>X_{ij}</math> (the ''j''<sup>th</sup> column of the ''i''<sup>th</sup> row of <math>X</math>) represents the value of the ''j''<sup>th</sup> variable associated with the ''i''<sup>th</sup> object. A regression model may be represented via matrix multiplication as :<math>y=X\beta+e,</math> where ''X'' is the design matrix, <math>\beta</math> is a vector of the model's coefficients (one for each variable), <math>e</math> 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 ([[Feature (machine learning)|features]]) measured in all samples.<ref>{{cite book |last1=Johnson |first1=Richard A |last2=Wichern |first2=Dean W |date=2001 |title=Applied Multivariate Statistical Analysis |publisher=Pearson |pages=111–112 |isbn=0131877151 }}</ref><ref>{{cite web|title=Basic Concepts for Multivariate Statistics p.2|url=https://support.sas.com/publishing/pubcat/chaps/56902.pdf |publisher=SAS Institute}}</ref> 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'' <sup>th</sup> person to the ''j'' <sup>th</sup> question. ==Examples== ===Arithmetic mean=== The design matrix for an [[arithmetic mean]] is a [[column vector|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 {''y''<sub>''i''</sub>, ''x''<sub>''i''</sub>}, for ''i'' = 1, 2, …, 7. The simple linear regression model is : <math> y_i = \beta_0 + \beta_1 x_i +\varepsilon_i, \,</math> where <math> \beta_0 </math> is the ''y''-intercept and <math>\beta_1</math> is the slope of the regression line. This model can be represented in matrix form as :<math> \begin{bmatrix}y_1 \\ y_2 \\ y_3 \\ y_4 \\ y_5 \\ y_6 \\ y_7 \end{bmatrix} = \begin{bmatrix}1 & x_1 \\1 & x_2 \\1 & x_3 \\1 & x_4 \\1 & x_5 \\1 & x_6 \\ 1 & x_7 \end{bmatrix} \begin{bmatrix} \beta_0 \\ \beta_1 \end{bmatrix} + \begin{bmatrix} \varepsilon_1 \\ \varepsilon_2 \\ \varepsilon_3 \\ \varepsilon_4 \\ \varepsilon_5 \\ \varepsilon_6 \\ \varepsilon_7 \end{bmatrix} </math> 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 [[Linear Regression|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 (<math>y_i</math>), values ''w''<sub>''i''</sub> and ''x''<sub>''i''</sub> of the two covariates are also observed. The model to be considered is :<math> y_i = \beta_0 + \beta_1 w_i + \beta_2 x_i + \varepsilon_i </math> This model can be written in matrix terms as :<math> \begin{bmatrix}y_1 \\ y_2 \\ y_3 \\ y_4 \\ y_5 \\ y_6 \\ y_7 \end{bmatrix} = \begin{bmatrix} 1 & w_1 & x_1 \\1 & w_2 & x_2 \\1 & w_3 & x_3 \\1 & w_4 & x_4 \\1 & w_5 & x_5 \\1 & w_6 & x_6 \\ 1& w_7 & x_7 \end{bmatrix} \begin{bmatrix} \beta_0 \\ \beta_1 \\ \beta_2 \end{bmatrix} + \begin{bmatrix} \varepsilon_1 \\ \varepsilon_2 \\ \varepsilon_3 \\ \varepsilon_4 \\ \varepsilon_5 \\ \varepsilon_6 \\ \varepsilon_7 \end{bmatrix} </math> 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 :<math> y_{ij} = \mu_i + \varepsilon_{ij}</math> which can be written :<math> \begin{bmatrix}y_1 \\ y_2 \\ y_3 \\ y_4 \\ y_5 \\ y_6 \\ y_7 \end{bmatrix} = \begin{bmatrix}1 & 0 & 0 \\1 &0 &0 \\ 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 1\end{bmatrix} \begin{bmatrix}\mu_1 \\ \mu_2 \\ \mu_3 \end{bmatrix} + \begin{bmatrix} \varepsilon_1 \\ \varepsilon_2 \\ \varepsilon_3 \\ \varepsilon_4 \\ \varepsilon_5 \\ \varepsilon_6 \\ \varepsilon_7 \end{bmatrix} </math> In this model <math>\mu_i</math> represents the mean of the <math>i</math>th group. ===One-way ANOVA (offset from reference group)=== The ANOVA model could be equivalently written as each group parameter <math>\tau_i</math> 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 :<math> y_{ij} = \mu + \tau_i + \varepsilon_{ij} </math> with the constraint that <math>\tau_1</math> is zero. :<math> \begin{bmatrix}y_1 \\ y_2 \\ y_3 \\ y_4 \\ y_5 \\ y_6 \\ y_7 \end{bmatrix} = \begin{bmatrix}1 &0 &0 \\1 &0 &0 \\ 1 & 0 & 0 \\ 1 & 1 & 0 \\ 1 & 1 & 0 \\ 1 & 0 & 1 \\ 1 & 0 & 1\end{bmatrix} \begin{bmatrix}\mu \\ \tau_2 \\ \tau_3 \end{bmatrix} + \begin{bmatrix} \varepsilon_1 \\ \varepsilon_2 \\ \varepsilon_3 \\ \varepsilon_4 \\ \varepsilon_5 \\ \varepsilon_6 \\ \varepsilon_7 \end{bmatrix} </math> In this model <math>\mu</math> is the mean of the reference group and <math>\tau_i</math> is the difference from group <math>i</math> to the reference group. <math>\tau_1</math> 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== {{Reflist}} ==Further reading== *{{cite book |first=Albert |last=Verbeek |chapter=The Geometry of Model Selection in Regression |title=Misspecification Analysis |editor-first=Theo K. |editor-last=Dijkstra |location=New York |publisher=Springer |year=1984 |pages=20–36 |isbn=0-387-13893-5 }} {{Matrix classes}} [[Category:Matrices (mathematics)]] [[Category:Regression analysis]] [[Category:Design of experiments]] [[Category:Multivariate statistics]] [[Category:Data]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Citation needed
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Matrix classes
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)