| Statistics Toolbox | Search  Help Desk |
| x2fx | Examples See Also |
Transform a factor settings matrix to a design matrix.
Syntax
D = x2fx(X) D = x2fx(X,'model')
Description
D = x2fx(X) transforms a matrix of system inputs, X, to a design matrix for a linear additive model with a constant term.
D = x2fx(X,'model') allows control of the order of the regression model.'model' can be one of these strings:
'interaction' - includes constant, linear, and cross product terms.
'quadratic' - interactions plus squared terms.
'purequadratic' - includes constant, linear and squared terms.
model, can be a matrix of terms. In this case each row of model represents one term. The value in a column is the exponent to raise the same column in X for that term. This allows for models with polynomial terms of arbitrary order.
x2fx is a utility function for rstool, regstats and cordexch.
Example
x = [1 2 3;4 5 6]'; model = 'quadratic';
D = x2fx(x,model)
D =
1 1 4 4 1 16
1 2 5 10 4 25
1 3 6 18 9 36
Let x1 be the first column of x and x2 be the second. Then, the first column of D is for the constant term. The second column is x1 . The 3rd column is x2. The 4th is x1x2. The fifth is x12 and the last is x22.
See Also
rstool,cordexch,rowexch,regstats