Weight matrix from the interaction of two other weight matrices
Source:R/weights_from_vector.R
interaction_weights.Rd
Provides a helper function for pre-generating interactions. Takes sparse weight/indicator matrices generated with e.g. Matrix::fac2sparse() or weights_from_vector() as input.
Arguments
- a
sparse weight/indicator matrix of class Matrix::dgCMatrix
- b
sparse weight/indicator matrix of class Matrix::dgCMatrix
Examples
a <- rep(c("k", "l", "l,k"), 2)
b <- rep(c("m", "n"), 3)
Wa <- weights_from_vector(a)
Wb <- Matrix::fac2sparse(b)
Wab <- interaction_weights(Wa, Wb)