Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: how to construct a mean squared Euclidean measure?
From
"[email protected]" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: how to construct a mean squared Euclidean measure?
Date
Wed, 16 Feb 2011 16:24:57 +0000
Hi all,
I am using Stata 10.1. I want to create a variable which captures the dissimilarity measure of a member who exit from a work group, sorted by firm and year. The dissimilarity is calculated in terms of the member’s job tenure in the group with respect to other members’ job tenures. More precisely the measure I am trying to construct is the mean squared Euclidean distance of a focal member i from each incumbent team member j and is given as: √( ∑(Xi ? Xj)2/(n-1)), where Xi is the tenure of the focal individual i, Xj is the tenure of incumbent j, with i not equal to j and n is the number of group members. Does anyone have an idea how to construct this measure using Stata? For more clarity, let me describe the data structure as below.
Observation ID
Year
Firm ID
Member ID
Tenure
1
1960
1
1
4
2
1960
1
2
2
3
1960
1
3
1
4
1960
2
4
2
5
1960
2
5
1
6
1961
1
1
4
7
1961
1
3
2
8
1961
2
2
0
9
1961
2
4
3
10
1961
2
5
2
This is a data structure with two firms over a two year observation period. For example, I want to construct a new variable for the distance measure of “Member ID: 1” in “Firm ID: 1” in the year 1960. In that case, the measure for the new variable for that observation would be:
√( ∑(Xi ? Xj)2/(n-1)); where i=1; j=2,3; Xi=4; X2=2; X3=1.
= √{[(4-2)2+(4-1)2]/(3-1)} = √(13/2)
which gives a measure of that member’s distance from all other members of that firm in 1960. Similarly, I want to construct measures for each of the observations for the variable “Member ID”. If you have some idea how to go forward with this calculation, please help me.
Thank you very much,
Chanchal
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/