Mathematica > Data Manipulation > Numerical Data > Statistical Model Analysis > DesignMatrix >
Mathematica > Data Manipulation > Statistical Data Analysis > Statistical Model Analysis > DesignMatrix >
Mathematica > Mathematics and Algorithms > Statistical Data Analysis > Statistical Model Analysis > DesignMatrix >

DesignMatrix

DesignMatrix
constructs the design matrix for the linear model .
  • With data in the form , the number of coordinates , , ... should equal the number of variables .
  • The design matrix m is formed from the values of basis functions at data points in the form
IncludeConstantBasisTruewhether to include a constant basis function
NominalVariablesNonevariables considered as nominal or categorical
WorkingPrecisionAutomaticprecision used in internal computations
Design matrix for a linear model:
Add a quadratic term:
Leave out the constant term:
Design matrix with two predictor variables:
Include a product term:
Assume predictor values , , ...:
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=
Use any numeric functions of the predictors:
Get the design matrix using exact arithmetic:
Use machine arithmetic:
Use arbitrary-precision arithmetic:
Use fixed 24-digit precision arithmetic:
A constant term is included by default:
Construct a design matrix without a constant term:
Treat x as a numeric variable:
Treat x as nominal:
Use nominal variables that are not numeric:
Treat only x as nominal:
Treat all predictors as nominal:
DesignMatrix constructs the design matrix used by LinearModelFit:
The matrix is the same for GeneralizedLinearModelFit:
New in 7
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF