Please suggest a way out to the following problem.

I have a T by n data matrix (say Y) where coulmns are time series of length
T.
To do some analysis in WinBUGS I need to construct my data as follows.

yy<-rep(Y,k) ## this will be a vector
Yk<-array(yy,dim=c(T,n,k)) ## data array

Here the definition of dim indices is

first index: T rows
second index: n columns
third index: for kth T by n array

EXAMPLE
T=3
n=2
k=2
Y<-matrix(c(1,2,3,4,5,6), ncol=n) ## my data matrix
yy<-rep(Y,k)
Yk<-array(yy,dim=c(T,n,k))
Yk  # this produces the following R output.

, , 1
     [,1] [,2]
[1,]    1    4
[2,]    2    5
[3,]    3    6
, , 2
     [,1] [,2]
[1,]    1    4
[2,]    2    5
[3,]    3    6

That is, I have copied the orignal data k=2 times. WinBUGS will be supplied
the following data

d<-list(Yk=Yk, T=T,n=n,k=k).

Now in WinBUGS I have to define a multivariate stochastic node as as follows

e[i,1:n,kk]~dmnorm(   ,   ) ## i= 1,2,...,T ; kk = 1,2,...,k

But Winbugs accepts only something like

e[ , , 1:n]~dmnorm(   ,   ).

That is "1:n" has to be given at the leftmost position.

This means that I need to change the definition of dim indices in R as
follows.

first index: for kth T by n array
second index: T rows
third index: n columns.

Specifically, I want the above output as

 1, ,
     [,1] [,2]
[1,]    1    4
[2,]    2    5
[3,]    3    6

2, ,
     [,1] [,2]
[1,]    1    4
[2,]    2    5
[3,]    3    6

I would appriciate any help in this regard.


Khurram Nadeem
PhD Student
Department of Math. & Stat. Sciences
University of Alberta

	[[alternative HTML version deleted]]


