| commat | R Documentation |
This function returns the (r c \times r c)
commutation matrix \mathbf{P} such that
\mathbf{P} \mbox{vec}(\mathbf{Y}) = \mbox{vec}(\mathbf{Y}'),
where \mathbf{Y} is a (r \times c) matrix (Magnus and Neudecker, 2019).
# Commutation matrix
commat(r, c)
# Vector of indexes for the rows of commutation matrix
commat_index(r, c)
r |
Number of rows of |
c |
Number of columns of |
A sparse (r c \times r c) matrix \mathbf{P} (commat),
or the vector of indexes for the rows of commutation matrix \mathbf{P}
(commat_index)
Magnus, J.R. and Neudecker, H. (2019), Matrix Differential Calculus with Applications in Statistics and Econometrics, third edition, New York, Wiley, pp. 54-55.
Utilities:
FoReco2matrix(),
aggts(),
as_ctmatrix(),
as_tevector(),
balance_hierarchy(),
csprojmat(),
cstools(),
ctprojmat(),
cttools(),
df2aggmat(),
lcmat(),
recoinfo(),
res2matrix(),
set_bounds(),
shrink_estim(),
shrink_oasd(),
teprojmat(),
tetools(),
unbalance_hierarchy()
Y <- matrix(rnorm(30), 5, 6)
P <- commat(5, 6)
P %*% as.vector(Y) == as.vector(t(Y)) # check
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.