LinearRegression`
LinearRegression`

DesignMatrix

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

DesignMatrix[data,funs,vars]

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

Details and Options

  • To use DesignMatrix, you first need to load the Linear Regression Package using Needs["LinearRegression`"].
  • 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 {{x1,y1,,f1},{x2,y2,,f2},}, where the number of coordinates x, y, is equal to the number of variables in the list vars.
  • The data can also be of the form {f1,f2,}, with a single coordinate assumed to take values 1,2,.
  • The argument funs can be any list of functions that depend only on the variables vars.
  • The following option can be given:
  • IncludeConstant Truewhether to automatically include a constant as one of the functions
  • With the default setting IncludeConstant->True, the constant 1 is included as the first entry in the list of basis functions if a constant is not included in funs.

Examples

open allclose all

Basic Examples  (2)

Design matrix for a straight line:

Design matrix for a quadratic curve:

Options  (1)

IncludeConstant  (1)

Design matrix for a quadratic curve without a constant term:

Wolfram Research (2007), DesignMatrix, Wolfram Language function, https://reference.wolfram.com/language/LinearRegression/ref/DesignMatrix.html.

Text

Wolfram Research (2007), DesignMatrix, Wolfram Language function, https://reference.wolfram.com/language/LinearRegression/ref/DesignMatrix.html.

CMS

Wolfram Language. 2007. "DesignMatrix." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/LinearRegression/ref/DesignMatrix.html.

APA

Wolfram Language. (2007). DesignMatrix. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/LinearRegression/ref/DesignMatrix.html

BibTeX

@misc{reference.wolfram_2024_designmatrix, author="Wolfram Research", title="{DesignMatrix}", year="2007", howpublished="\url{https://reference.wolfram.com/language/LinearRegression/ref/DesignMatrix.html}", note=[Accessed: 23-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_designmatrix, organization={Wolfram Research}, title={DesignMatrix}, year={2007}, url={https://reference.wolfram.com/language/LinearRegression/ref/DesignMatrix.html}, note=[Accessed: 23-December-2024 ]}