Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

matrix2bdiag

Convert a Matrix into a Block Diagonal Matrix


Description

It converts a matrix into a block diagonal matrix.

Usage

matrix2bdiag(x, ...)

Arguments

x

A k x p matrix of numerics or characters.

...

Further arguments to be passed to vec2symMat

Details

Each row of x is converted into a symmetric matrix via vec2symMat. Then the list of the symmetric matrices is converted into a block diagonal matrix via a function written by Scott Chasalow posted at http://www.math.yorku.ca/Who/Faculty/Monette/pub/stmp/0827.html.

Author(s)

Mike W.-L. Cheung <mikewlcheung@nus.edu.sg>

See Also

Examples

(m1 <- matrix(1:12, ncol=6, byrow=TRUE))
#      [,1] [,2] [,3] [,4] [,5] [,6]
# [1,]    1    2    3    4    5    6
# [2,]    7    8    9   10   11   12

matrix2bdiag(m1)
#      [,1] [,2] [,3] [,4] [,5] [,6]
# [1,]    1    2    3    0    0    0
# [2,]    2    4    5    0    0    0
# [3,]    3    5    6    0    0    0
# [4,]    0    0    0    7    8    9
# [5,]    0    0    0    8   10   11
# [6,]    0    0    0    9   11   12

metaSEM

Meta-Analysis using Structural Equation Modeling

v1.2.5
GPL (>= 2)
Authors
Mike Cheung [aut, cre] (<https://orcid.org/0000-0003-0113-0758>)
Initial release
2020-11-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.