asymetric affinity analysis , matrix computation

Hi i would like to do a affinity analysis for product bought by customers. some product are not independants ( you need to by product 1 to be able to install product 2) so the relationship is assymetric.  so product 2 bought means 100% product 1 bought, but not vice versa.

i would like to distinguish this kind of relation  to handle them differently in the analysis afterwards. 

my idea would be to do an autocorrelation matrix of the cross matrix (customer basket / options )  and then to normalize the upper right by the sum of the first product (line) the lower left by the second product (column). then i can check the kind of assymetry in the relationship...

 Xmatrix           option 1      option 2   option 3

customer 1            1               0                1

customer 2           0               1                1 

cusotmer 3           1                1                 1

==> cor (Xmatrix, t(Xmatrix)) 

==> do a for loop to divide what is up right from the diagonal with the number in the diagonal at the row index, lower by the diagonal at the column index...

unfortunately i do not know hw to perform a matrix computation and re use the results for display afterwards,... and there are maybe some standard/existing way to do this kind of analysis. 

if you could give me some small scripts to start with or tutorial links, that would greatly help me 

thanks for your help 


(1) Answer