Dear Statalist.
I am trying to generate a new variable (“wanted”) that captures for each individual (“id”) the extent to which the observed characteristic “char” on “id” is similar to an observed characteristic “char_r” on “id” that is measured from a reference group.
The observed characteristics “char” and “char_r” may take on either positive or negative values. I am planning to use “wanted” in a regression model as a measure of how similar “id” is to its reference group. In this respect, the values of “wanted” need to be meaningful or comparable across different “id”. Here is a small and simplified toy dataset that illustrates the nature of the data:
Any and all suggestions or comments regarding this problem are very welcome.
Thanks!
I am trying to generate a new variable (“wanted”) that captures for each individual (“id”) the extent to which the observed characteristic “char” on “id” is similar to an observed characteristic “char_r” on “id” that is measured from a reference group.
The observed characteristics “char” and “char_r” may take on either positive or negative values. I am planning to use “wanted” in a regression model as a measure of how similar “id” is to its reference group. In this respect, the values of “wanted” need to be meaningful or comparable across different “id”. Here is a small and simplified toy dataset that illustrates the nature of the data:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte id double(char char_r) 1 -.1751724 -.0768999 2 -.1751724 .0705089 3 .0213727 .0642464 4 .0213727 -.0277636 end
Thanks!
Comment