Hi all,
I've been under the impression from the stata manual on the alpha command that the generate option sums the values over list items and divides the sum by the number of items. However, I'm getting different results when creating a scale by using the alpha command's generate option and when I manually create the scale by averaging the values over the scale items. I provide a sample of the data below. For example, when I use alpha's generate command, I get a questscore of 2.5 for id=111, whereas the egen rowmean()command produces a questscore of 3.
Here's what I'm doing. Am I missing something about the way the alpha, gen() command works?
I've been under the impression from the stata manual on the alpha command that the generate option sums the values over list items and divides the sum by the number of items. However, I'm getting different results when creating a scale by using the alpha command's generate option and when I manually create the scale by averaging the values over the scale items. I provide a sample of the data below. For example, when I use alpha's generate command, I get a questscore of 2.5 for id=111, whereas the egen rowmean()command produces a questscore of 3.
Here's what I'm doing. Am I missing something about the way the alpha, gen() command works?
Code:
clear input int id long(quest1 quest2 quest3 quest4 quest5 quest6 quest7 quest8 quest9 quest10 quest11 quest12) 111 3 3 3 3 3 3 3 3 3 3 3 3 112 3 3 3 4 3 5 5 3 1 3 4 4 113 2 4 4 3 2 2 3 2 3 2 5 2 114 3 4 2 1 3 2 2 3 5 2 3 3 115 3 3 3 3 3 3 3 3 3 3 3 3 116 3 3 2 3 3 3 2 3 2 3 2 4 117 4 3 3 2 4 4 3 5 3 3 4 4 118 3 3 3 3 3 1 1 3 1 4 5 3 119 3 2 3 3 3 3 3 3 3 3 3 3 120 3 3 3 3 3 3 3 3 3 3 3 3 end local q "quest1 quest2 quest3 quest4 quest5 quest6 quest7 quest8 quest9 quest10 quest11 quest12" alpha `q', gen(questscore) gen quest7r = 6-quest7 //this item is reverse coded in the original gen quest11r = 6-quest11 //this item is reverse coded in the original local q "quest1 quest2 quest3 quest4 quest5 quest6 quest7r quest8 quest9 quest10 quest11r quest12" egen questscore_e = rowmean(`q')
Comment