Imagine a list of two arrays. The first array is like a vector that
contains ten 2x2 matrices. The second array contains two vectors of 2x2
matrices of length five and three, respectively. I run the code and it
gives me what I want for the first array. However, it disappoints me for
the second array: both vectors have length three instead of five and three,
respectively. I suspect that the code might need some kind of 'trick' to
work properly, but I cannot find exactly what this "trick" would look like.

I give you my code. Please feel free to suggest me another way!



sx  = c( 53 ,  30 ,  65 ) ## Successes in interventions



sy  = c( 54 ,  29 ,  43  ) ## Successes in control



fx  = c( 37 ,  21 ,  32  ) ## Failures in interventions



fy  = c(  40 ,  20 ,  20  ) ## Failures in control



x  = c(  4 ,  4 ,  0  ) ## Missing cases in intervention



y  = c(  1 ,  0 ,  2  ) ## Mising cases in control (Fluoxetine)



tx  = c( 94 , 55 , 97 ) ## Total number in interventions



ty  = c( 95 , 49 , 65  ) ## Total number in control



t  = c(  1 ,  2,  2 ) # Interventions



##################### Histogram of P-values for each Trial and across all
Trials (CHAPTER A' - Histogram) ########################################



tn<-as.vector(table(t));tn # A dataframe of length equal to the number of
interventions. Each element corresponds to the

                        # umber of trials that the corresponding treatment
studies.

# An example to call a specific element of the dataframe tn[2,2]



mat.stat<-vector("list",length(unique(t)))

for(i in 1:length(unique(t))){

mat.stat[[i]]<-array(0,dim=c(2,2,tn[i]))

for(b in 1:2){

   for(j in 1:2){

     for(k in 1:tn[i]){

mat.stat[[i]][,,k]<-matrix(c(sx[t==i][k],sy[t==i][k],fx[t==i][k],fy[t==i][k]),nrow=2,ncol=2,byrow=T)


   }

  }

 }

}

mat.stat



Nx<-vector("list",length(unique(t)))

Ny<-vector("list",length(unique(t)))

n<-vector("list",length(unique(t)))

for(i in 1:length(unique(t))){

Nx[[i]]<-array(0,dim=c(1,tn[i],1))+x[t==i]+1 # A vector with the number of
all possible allocations of missing cases in intervention across the trials

Ny[[i]]<-array(0,dim=c(1,tn[i],1))+y[t==i]+1

n[[i]]<-(Nx[[i]])*(Ny[[i]])

}

Nx;Ny;n

add<-vector("list",length(unique(t)))

for(i in 1:length(unique(t))){

for(k in 1:tn[i]){

add[[i]]<-array(1,dim=c(2,2,n[[i]][k],tn[i]))

}

}

add

	[[alternative HTML version deleted]]


