Dear all,

I have 2 matrices, one is a 8x3 matrix, called X; the other matrix is a 3x3 
indicator matrix with the diagonal element as 0 or 1. when a variable is 
included in the model, the corresponding diagonal element is 1, otherwise, it 
is 0.  Let A be a set of matrices that contain the possible indicator matrix. 
e.g.,
A= [A1, A2, A3], 
where A1= [1,0,0;0,0,0,0,0,0],
A2 =[1,0,0;0,1,0,0,0,0], 
A3 =[1,0,0;0,0,0,0,1,0]

In order to derive the new X matries depending on the indicator matrices, I use 
for loops to multiply both X and A as following

p<-3
for ( i in 1:p){
          XX<- X%*%A[i]
        }

However, it only shows the result when i=p. How can I derive the results which 
include all possible value of XX[i], i=1,..,p, rather than just i=p

thanks for any help

Ya-Hsiu



        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to