This model matrix is similar to model.matrix. But it does not omit unnecessary columns.
ModelMatrix(Formula, Data, KeepOrder=FALSE, XpX=FALSE)Model matrix and attributes similar to the output of model.matrix.
design matrix, i.e. model matrix
cross-product of the design matrix, X'X
detailed information about terms such as formula and labels
term indices
assignemnt of columns for each term in order, different way of expressing term indices
a conventional formula for a linear model
a data.frame to be analyzed
If KeepOrder is TRUE, terms in Formula will be kept. This is for Type I SS.
If XpX is TRUE, the cross-product of the design matrix (XpX, X'X) will be returned instead of the design matrix (X).
Kyun-Seop Bae k@acr.kr
It makes the model(design) matrix for GLM.