makellway: Constructing named all possible interactions from a given set of factors.
Description
makeallway
takes a data frame of factors, each denoting a treatment level, and returns a matrix of 0's and 1's for all possible interactions.The current version can produce up to four way interactions.Usage
makeallway(X, threshold = 0.999999, deletion = TRUE, make.reference = TRUE,
sparse.use = FALSE, nway)
Arguments
X
A matrix of data frame of treatments, each column interpreted as a factor.
threshold
Threshold to drop correlated columns.
deletion
Whether to automatically drop pairwise linearly dependent columns and columns of all 0's or 1's.
make.reference
Whether to make a reference matrix to check which columns are dropped when makeallway=TRUE
.
sparse.use
Whether to use a sparse matrix or not.
nway
The order of interaction terms. All possible interactions up to this value are computed.
Value
- FinalData
- A named matrix of 0's and 1's.
- reference
- A matrix that keeps track of all columns and shows which columns are dropped.
Details
Useful for construcing a matrix for FindIt
with type="multiple"
. Takes a data frame of factors and returns a design matrix with all possible interactions. A named matrix of 0's and 1's, for every possible interaction, is returned. Pairwise linearly dependent columns and columns of all 0's or 1's are eliminated.
Examples
Run this code#See the help page for FindIt() for an example.
Run the code above in your browser using DataLab