Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Extracting Scores from a Group Subset Defined by a Different Variable


    ​​​​​​Okay, I hope I can describe what I am trying to accomplish here. I am sure there is a much easier way of doing this than how I am, but I'm too deep now. So any help would be appreciated.

    I want to do significance testing on the average scores between three groups. In order to do this, I did a grouping code to combine a few of the other variables (Yes or No responses to 4 different questions: 1. Have you eaten less than you should? 2. Satisfied with insurance coverage? 3. Do you lack companionship? 4. Do you need help reading health materials?) and then generated a new column in which I recoded to create 3 groups.

    egen socials = group (eatless12 ins_satisfaction lack_companionship readhealth), label


    gen socialsnum=socials
    recode socialsnum 4=1 5=2 6=2 9=2 1=2 2=3 3=3 7=3 8=3 10=3
    label define socialsnum 1 "No Social Factors" 2 "One Social Factor" 3 "Two Social Factors", replace


    Then this is where I am stuck. I am trying to compare the SCORES of groups 1, 2, and 3. Initially, I tried to create a new variable of the scores for a single group but I couldn't extract only the scores of group 1, etc.

  • #2
    You don't actually need to create a group score variable to do this. In fact, you cannot even use such a variable for your stated purpose. You can just do:
    Code:
    regress score i.socialsnum
    The significance test for the regression as a whole will be the significance test for between-group differences in scores.

    That said, if you have some other use for an average group score variable:
    Code:
    by group, sort: egen avg_group_score = mean(score)
    will do that.

    Comment

    Working...
    X