Hi Statalist users!
I an having a problem programing a rolling loop in mata. My goal is to take the rows of a matrix (matrix M in this case) and multiple them each together as a vector that I would code as the name of the rows that I multiplied together (example U11...U12...U13). However, when I run the code it writes over the row that I have created each time... and does not use my labeling designation from the code.
This problem seems simple, but I'm stumped and would appreciate any help!
Thanks,
Nick
Below is the code I am using.
Code:
for (i=1; i<=rows(M); i++) {
for (j=1; j<=rows(M); j++){
U`i'`j' = M[|i,.|]:*M[|j,.|]
U`j'`i' = M[|j,.|]:*M[|i,.|]
}
}
I an having a problem programing a rolling loop in mata. My goal is to take the rows of a matrix (matrix M in this case) and multiple them each together as a vector that I would code as the name of the rows that I multiplied together (example U11...U12...U13). However, when I run the code it writes over the row that I have created each time... and does not use my labeling designation from the code.
This problem seems simple, but I'm stumped and would appreciate any help!
Thanks,
Nick
Below is the code I am using.
Code:
for (i=1; i<=rows(M); i++) {
for (j=1; j<=rows(M); j++){
U`i'`j' = M[|i,.|]:*M[|j,.|]
U`j'`i' = M[|j,.|]:*M[|i,.|]
}
}
Comment