Join us for
RADAR: AI Edition

FoReco (version 1.0.0)

commat: Commutation matrix

Description

This function returns the (rc×rc) commutation matrix P such that Pvec(Y)=vec(Y), where Y is a (r×c) matrix (Magnus and Neudecker, 2019).

Usage

commat(r, c)

Value

A sparse (rc×rc) matrix, P.

Arguments

r

Number of rows of Y.

c

Number of columns of Y.

References

Magnus, J.R. and Neudecker, H. (2019), Matrix Differential Calculus with Applications in Statistics and Econometrics, third edition, New York, Wiley, pp. 54-55.

See Also

Utilities: FoReco2matrix(), aggts(), balance_hierarchy(), csprojmat(), cstools(), ctprojmat(), cttools(), df2aggmat(), lcmat(), recoinfo(), res2matrix(), shrink_estim(), teprojmat(), tetools(), unbalance_hierarchy()

Examples

Run this code
Y <- matrix(rnorm(30), 5, 6)
P <- commat(5, 6)
P %*% as.vector(Y) == as.vector(t(Y)) # check

Run the code above in your browser using DataLab