Learn R Programming

BHH2 (version 0.2-2)

ffFullMatrix: Full model matrix from a design matrix

Description

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

Usage

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.

Value

  • The function returns list with the following components:
  • Xamatrix
  • . Augmented matrix with columns for the constant terms, blocking factors, main effects, second order interactions, ..., etc.
  • xnumeric vector. Design matrix X factor (column) numbers used to build the complete model matrix.
  • maxIntnumeric. The highest interaction order.
  • nTermsnumeric vector. Contains the number of blocking factors, main effects, 2nd order interaction effects, ..., etc.

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.

See Also

ffDesMatrix

Examples

Run this code
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)

Run the code above in your browser using DataLab