Skip to contents

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.

Usage

interaction_weights(a, b)

Arguments

a

sparse weight/indicator matrix of class Matrix::dgCMatrix

b

sparse weight/indicator matrix of class Matrix::dgCMatrix

Value

sparse interaction 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)