commat {FoReco}R Documentation

Commutation matrix

Description

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.

Usage

commat(r, c)

Arguments

r

Number of rows of \(\mathbf{Y}\).

c

Number of columns of \(\mathbf{Y}\).

Value

A sparse (\(r c \times r c\)) matrix, \(\mathbf{P}\).

References

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

See Also

Other utilities: Cmatrix(), FoReco2ts(), agg_ts(), arrange_hres(), ctf_tools(), hts_tools(), lcmat(), oct_bounds(), residuals_matrix(), score_index(), shrink_estim(), thf_tools()

Examples

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

[Package FoReco version 0.2.6 Index]