Dear Stata forum,
I'm interesting in performing the following operation:
Suppose I have a variable called a with 5 rows, that takes the values 0, and 1 as shown below
**** view from data editor***
var1
row1 a1
row2 a2
row3 a3
row4 a4
row5 a5
row6 b1
row7 b2
row8 b3
row9 b4
row10 b5
****end view from data editor***
I'm interesting in calculating all different pairwise differences between a's (a1 - a2, a1-a3, a1-a4, a1-a5, a2-a3, a2-a4...) These are all the elements above the diagonal of a matrix with values a1-a5 on the rows, and a1-a5 on the columns.
Once all these differences are calculated, I want to get the median.
After that, I want to do the same two steps with the b values, and so forth.
Are you aware of any function that could allow me to do this? I was looking for an egen-type function, but I couldnt find any that performs this calculation.
Thanks in advance for all your help as always.
Laurie
I'm interesting in performing the following operation:
Suppose I have a variable called a with 5 rows, that takes the values 0, and 1 as shown below
**** view from data editor***
var1
row1 a1
row2 a2
row3 a3
row4 a4
row5 a5
row6 b1
row7 b2
row8 b3
row9 b4
row10 b5
****end view from data editor***
I'm interesting in calculating all different pairwise differences between a's (a1 - a2, a1-a3, a1-a4, a1-a5, a2-a3, a2-a4...) These are all the elements above the diagonal of a matrix with values a1-a5 on the rows, and a1-a5 on the columns.
Once all these differences are calculated, I want to get the median.
After that, I want to do the same two steps with the b values, and so forth.
Are you aware of any function that could allow me to do this? I was looking for an egen-type function, but I couldnt find any that performs this calculation.
Thanks in advance for all your help as always.
Laurie
Comment