Re: [R] Block-diagonal matrix

2005-09-01 Thread Robin Hankin
Hi adiag() from the magic package does what you want: > library(magic) Loading required package: abind > a <- matrix(1,2,2) > b <- matrix(6,2,3) > adiag(a,b) [,1] [,2] [,3] [,4] [,5] [1,]11000 [2,]11000 [3,]00666 [4,]00

[R] Block-diagonal matrix

2005-08-31 Thread Caio Lucidius Naberezny Azevedo
Dear R-users, Does anybody know how to construct a block-diagonal matrix (with the blocks being different matrixs, concerning the dimension and the values), without use loops ? Thanks all, Caio - [[alternative HTML version delet

Re: [R] Block-Diagonal Matrix and Multivariate Skew Normal

2005-08-31 Thread Liaw, Andy
For your first question, here's a function originally posted by Ben Bolker, with modification by Rich Raubertas: blockdiag <- function (x, ...) { if (!is.list(x)) x <- list(x) args <- list(...) if (length(args) > 0) args <- c(x, args) else args <- x idx <- wh

[R] Block-Diagonal Matrix and Multivariate Skew Normal

2005-08-31 Thread Caio Lucidius Naberezny Azevedo
Dear R-users, Does anybody know how to construct a block-diagonal matrix (with the blocks being different matrixs, concerning the dimension and the values) ? I would like to know also if there is any package that generates values from a multivariate skew normal distribution. Thanks all,

Re: [R] block diagonal matrix function

2004-05-27 Thread Gabor Grothendieck
The zoo package can handle multiway merges of this sort. The following example uses your two matrices m1 and m2 but any number could have been supplied. Each matrix must be converted to a zoo object with successive times and then NAs in the result replaced with zeros. If the names are important

Re: [R] block diagonal matrix function

2004-05-27 Thread Dimitris Rizopoulos
leuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: "Robin Hankin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, May 27, 2004 10:24 AM Subject: [R] block diagonal matrix function > Hello List > &g

[R] block diagonal matrix function

2004-05-27 Thread Robin Hankin
Hello List I have just written a little function that takes two matrices as arguments and returns a large matrix that is composed of the two input matrices in upper-left position and lower-right position with a padding value everywhere else. (function definition and toy example below). I need nons