Full model matrix from a design matrix

Share:

Description

The function builds the full matrix with the constant term, main effects and interactions from a design matrix.

Usage

1
    ffFullMatrix(X, x, maxInt, blk = NULL)

Arguments

X

numeric matrix. Design matrix.

x

numeric vector. Design matrix entries to use to construct the full model matrix.

maxInt

numeric. Highest interaction order.

blk

numeric matrix. Each column correspond to a blocking factor.

Details

Columns x of matrix X are used for main effects. All the 2, ... , maxInt order interaction are constructed. The first columns of the final matrix correspond to the constant term (1's) and block factors.

Value

The function returns list with the following components:

Xa

matrix

. Augmented matrix with columns for the constant terms, blocking factors, main effects, second order interactions, ..., etc.

x

numeric vector. Design matrix X factor (column) numbers used to build the complete model matrix.

maxInt

numeric. The highest interaction order.

nTerms

numeric vector. Contains the number of blocking factors, main effects, 2nd order interaction effects, ... , etc.

Author(s)

Ernesto Barrios

See Also

ffDesMatrix

Examples

1
2
3
print(X <- ffDesMatrix(5,gen=list(c(5,1,2,3,4))))
ffFullMatrix(X[,1:4],x=c(1,2,3,4),maxInt=2,blk=X[,5])
ffFullMatrix(X[,1:5],x=c(1,3,5),maxInt=3)