Dear All
I am kind of stuck up with a code a part of which seems to be causing a problem, or at least I think so. May be the community can help me. Its simple but I suppose I am missing something. I generate a data matrix X, say of order n*p, where n represents independent row-vectors and p correlated col vectors. Let the row representation be X = (X_1, . . ., X_n). I generate the differences of these vectors as D_{ab} = X_a X_b, with different indices a and b, and similarly D_{cd} = X_c X_d, and make a quadratic form D_{ab}D_{cd} = A_{abcd}, say. Please note that, here a is unequal b, c is unequal d, a is unequal c, b is unequal d. By slightly shuffling the same set of vectors, I generate two other similar quadratic forms, say A_{acbd} and A_{adcb}, where the indices are again as unequal as stated above. In the R-code (a part of ) below, I compute these three forms using pata, patb, patc, respectively, using kronecker products. But from the final result of this code I get the feeling there is a difference between what I want the code to do and what it actually does. en <- matrix(1, n, 1) jn <- matrix(1, n, n) dev <- jn - diag(n) pata <- dev%x%dev patb <- jn%x%jn - diag(n)%x%diag(n) patc <- jn%x%diag(n) - diag(n)%x%jn Any help will be sincerely appreciated! Best regards MR Ahmad [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org 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.