Row-Wise Kronecker Product
Calculates the row-wise Kronecker product between two matrices with the same number of rows.
row.kronecker(X, Y)
X
: matrix of dimension Y
: matrix of dimension Given X
of dimension c(n, p)
and Y
of dimension c(n, q)
, this function returns
cbind(x[,1] * Y, x[,2] * Y, ..., x[,p] * Y)
which is a matrix of dimension c(n, p*q)
Matrix of dimension where each row contains the Kronecker product between the corresponding rows of X
and Y
.
Nathaniel E. Helwig helwig@umn.edu
Used by the rk.model.matrix
to construct basis functions for interaction terms
See kronecker
for the regular kronecker product
X <- matrix(c(1, 1, 2, 2), nrow = 2, ncol = 2) Y <- matrix(1:6, nrow = 2, ncol = 3) row.kronecker(X, Y)
Useful links