DesignMatrix

DesignMatrix[{{x11, x12, ..., y1}, {x21, x22, ..., y2}, ...}, {f1, f2, ...}, {x1, x2, ...}]
constructs the design matrix for the linear model .

Details and OptionsDetails and Options

ExamplesExamplesopen allclose all

Basic Examples (3)Basic Examples (3)

Design matrix for a linear model:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//MatrixForm=

Add a quadratic term:

In[3]:=
Click for copyable input
Out[3]//MatrixForm=

Leave out the constant term:

In[4]:=
Click for copyable input
Out[4]//MatrixForm=

Design matrix with two predictor variables:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//MatrixForm=

Include a product term:

In[3]:=
Click for copyable input
Out[3]//MatrixForm=

Assume predictor values , , ...:

In[1]:=
Click for copyable input
Out[1]//MatrixForm=
New in 7
New to Mathematica? Find your learning path »
Have a question? Ask support »