search for: blockdiag

Displaying 7 results from an estimated 7 matches for "blockdiag".

2004 May 27
2
block diagonal matrix function
...oy example below). I need nonsquare matrices and rowname() and colname() inherited appropriately. Two questions: (1) Is there a better way to do this? (kronecker() isn't applicable here) (2) How do I generalize it to take an arbitrary number of matrices as inputs? TIV Robin "blockdiag" <- function (m1, m2, p.tr = 0, p.ll = 0) { ## p.tr and p.ll are padding values topleft <- m1 topright <- matrix(p.tr, nrow(m1), ncol(m2)) colnames(topright) <- colnames(m2) lowleft <- matrix(p.ll, nrow(m2), ncol(m1)) lowright <- m2 rbind(cb...
2002 Feb 26
3
a trick ??
Dear R users, Suppose i have an A square matrix rxr. I want to obtain a block matrix B (pxr,pxr) where the p diagonal blocks are A and the others values are 0. I would like to do something like : diag(A,ncol=pr, nrow=pr) How can i do it ?? Thanks in advance, Olivier. -- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- Olivier MARTIN PhD student phone: (33) 04
2004 Oct 01
2
multiple dimensional diag()
Hi I have two arbitrarily dimensioned arrays, "a" and "b", with length(dim(a))==length(dim(b)). I want to form a sort of "corner-to-corner" version of abind(), or a multidimensional version of blockdiag(). In the case of matrices, the function is easy to write and if a=matrix(1,3,4) and b=matrix(2,2,2), then adiag(a,b) would return: [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1 1 1 1 0 0 [2,] 1 1 1 1 0 0 [3,] 1 1 1 1 0 0 [4,] 0 0 0 0...
2005 Jan 28
2
Direct sum of matrices
Hi R users: How can I built a direct sum function of matrices in R? I mean A(mxn), B(pxq), C(rxs),... X<-ds(A,B,C,...) X = [ A, 0, 0 0, B, 0 0, 0, C] ((m+p+r+...) x (n+q+s+...)) Thank you for your help. Kenneth -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
2005 Aug 31
1
Block-Diagonal Matrix and Multivariate Skew Normal
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, Caio --------------------------------- [[alternative HTML version deleted]]
2008 Dec 08
1
DLM - Covariates in the system equation
Is there a way to add covariates to the system equation in a time-varying approach: Y[t] = F'[t]theta[t] + v[t], v[t] ~ N[0,V] #observation equation theta[t] = theta[t-1] + psi*Z[t] + w[t], w[t] ~ N[0,W] #system equation While F[t] is a matrix of regressors to capture the short term effect on the response series Y, Z[t] measures the long-term effect of either (1) two policies by a step
2003 Nov 11
4
A co-occurrence matrix
Dear R experts, I have a matrix (from some sort of classification) like this: object group [1,] 1 1 [2,] 2 2 [3,] 3 1 [4,] 4 1 [5,] 5 3 And I need something like this: [,1] [,2] [,3] [,4] [,5] [1,] 1 0 1 1 0 [2,] 0 1 0 0 0 [3,] 1 0 1 1 0 [4,] 1 0 1 1 0 [5,] 0 0 0 0 1 where all