Announcement

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

  • How to classify handgrip?

    Dear all,

    I'm currently have a research about handgrip strength in highschool student. I need to classify it into 3 categories: Under, Nomal, Over, based on the table here:
    Age Gender Under Normal Over
    15 Male <34 >=34 <40.9
    15 Female <24.5 >=24.5 >28.5
    16 Male <36.9 >=36.9 >43.2
    16 Female <26 >=26 >29
    And I have some data:
    Age Gender Handgrip (kg)
    15 Male 40.8
    15 Female 19.2
    15 Female 30.1
    16 Male 27.7
    16 Female 23.3
    16 Female 17
    Please forgive my poor English.
    Thank you so much in advance for any help!

    Best regards,
    Vivian

  • #2
    Code:
    clear
    set obs 1000
    
    g male = runiform()>0.5
    g age = 15
    replace age = 16 if runiform()>0.5
    g handgrip = runiform(20,80)
    g age16 = age==16
    
    g bound1 = 34*(male & !age16) + 36.9*(male & age16) + 24.5*(!male & !age16) + 26*(!male & age16) 
    g bound2 = 40.9*(male & !age16) + 43.2*(male & age16) + 28.5*(!male & !age16) + 29*(!male & age16) 
    
    g griptype = 2
    replace griptype = 1*(handgrip < bound1) + 3*(handgrip > bound2)
    label var griptype "Grip Category"
    label define glab 1 "Under" 2 "Normal" 3 "Over"
    label values griptype glab

    Comment


    • #3
      There are many ways to do this. Here's another: assume students are 2 for normal unless there is evidence to the contrary. This assumes an indicator female which is 1 for female and 0 for male.

      Code:
      gen class = 2 if !missing(female, age, handgrip) 
      replace class = 1 if  (female == 0 & age == 15 & handgrip < 34) | (female == 0 & age == 16 & handgrip < 36.9) 
      replace class = 1 if  (female == 1 & age == 15 & handgrip < 24.5) | (female == 1 & age == 16 & handgrip < 26)
      There are two more statements for class 3. Watch out for missing values.

      Comment


      • #4
        Originally posted by George Ford View Post
        Code:
        clear
        set obs 1000
        
        g male = runiform()>0.5
        g age = 15
        replace age = 16 if runiform()>0.5
        g handgrip = runiform(20,80)
        g age16 = age==16
        
        g bound1 = 34*(male & !age16) + 36.9*(male & age16) + 24.5*(!male & !age16) + 26*(!male & age16)
        g bound2 = 40.9*(male & !age16) + 43.2*(male & age16) + 28.5*(!male & !age16) + 29*(!male & age16)
        
        g griptype = 2
        replace griptype = 1*(handgrip < bound1) + 3*(handgrip > bound2)
        label var griptype "Grip Category"
        label define glab 1 "Under" 2 "Normal" 3 "Over"
        label values griptype glab
        Thank you both of you.

        But what happens if I have more than two value of age. For example,
        Age Gender Under Normal Over
        15 Male <34 >=34 >40.9
        15 Female <24.5 >=24.5 >28.5
        16 Male <36.9 >=36.9 >43.2
        16 Female <26 >=26 >29
        17 Male <39.6 >=39.6 >46.2
        17 Female <26.3 >=26.3 >30.3
        18 Male <40.7 >=40.7 >47.2
        18 Female <26.5 >=26.5 >31.5

        Comment


        • #5
          You need more code to handle extra possibilities.

          Comment


          • #6
            I think perhaps the simplest way is to create a "threshold.dta" file with the info in the table from #4, with Age, Gender, and the values for Under and Over (ignore the Normal, since you're just going to use < and >, with the rest being 2).

            Then,
            Code:
            joinby Age Gender using threshold
            and you'll get two variables Under and Over that represent the thresholds specific to each age and gender.

            Then use the command
            Code:
            g griptype = 2 
             replace griptype = 1*(handgrip < Under) + 3*(handgrip > Over)

            Comment

            Working...
            X