1) If part1, part2, part3 in the example below are a vector, I need the dot product of the vector for every pair in every year. Said another way, if person 1 and person 2 (in the below example) are the first pair: I need to multiply (0.33 * 0.2) + (0.33 * 0) + (0.34 * 0.8). I need to do this for all pairwise combinations within the same year. And repeat for all years.
2) Then for each person, within each year, I need to sum their scores from step 1).
Code:
clear input person year part1 part2 part3 1 2010 .33 .33 .34 2 2010 .2 0 .8 3 2010 .2 0 .8 1 2011 .4 .3 .4 2 2011 .5 .3 .2 3 2011 .1 .2 .7 end
I checked it by hand (after step 2) for person 1 in 2010 and got 0.676. For persons 2 and 3 in 2010, I got 1.018.
Thanks in advance.
0 Response to multiply vectors; dot product
Post a Comment