DesignMatrix

As of Version 7.0, DesignMatrix is part of the built-in Mathematica kernel.


gives the design matrix for data as a linear combination of the functions funs of the variables vars.

Details and OptionsDetails and Options

  • To use , you first need to load the Linear Regression Package using .
  • The i^(th) row of a design matrix contains the values of the basis functions funs evaluated at the values for the i^(th) element in data.
  • The data can have the form , where the number of coordinates is equal to the number of variables in the list vars.
  • The data can also be of the form , with a single coordinate assumed to take values .
  • The argument funs can be any list of functions that depend only on the variables vars.
  • The following option can be given:
  • IncludeConstantTruewhether to automatically include a constant as one of the functions
  • With the default setting IncludeConstant->True, the constant is included as the first entry in the list of basis functions if a constant is not included in funs.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

In[1]:=
Click for copyable input

Design matrix for a straight line:

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

Design matrix for a quadratic curve:

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