Announcement

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

  • #16
    Sorry, but I can't follow this.

    Comment


    • #17
      I was afraid that i might not be clear. I am sorry. I need a code that will calculate a number/percentage of participants who got "0" correct responses out of 5; those who got 1 correct, those who got 2 correct and so on...until those answered all 5 questions correct. So its a total count of 0 correct responses, 1 correct, 2 correct, 3 correct, 4 correct, and 5 correct. So, that will be five groups of respondents.

      Comment


      • #18
        It would help to understand what tells us that a question has been answered correctly. Your post in #3 has answers such as "agree", "disagree", etc. But how do we know if an individual's response to a particular question is correct?

        Comment


        • #19
          Hi Hemanshu, thanks. Sorry for a delayed reply, I was not feeling well. There are five questions. In questions 1 to 4 "agree" is correct, and in question 5 "Agree" is incorrect.

          Comment


          • #20
            So you might do something simple like the following:

            Code:
            * Example generated by -dataex-. For more info, type help dataex
            clear
            input float(id q1 q2 q3 q4 q5)
            1 1 2 2 3 3
            2 1 2 1 2 1
            3 1 2 2 1 3
            4 1 3 3 2 2
            5 1 1 1 2 2
            6 1 1 1 1 2
            end
            
            * mark correct answers
            
            gen byte q1_iscorrect = (q1 == 1)
            gen byte q2_iscorrect = (q2 == 1)
            gen byte q3_iscorrect = (q3 == 1)
            gen byte q4_iscorrect = (q4 == 1)
            gen byte q5_iscorrect = (q5 == 2)
            
            * count correct answers
            gen byte num_correct = q1_iscorrect + q2_iscorrect + q3_iscorrect + q4_iscorrect + q5_iscorrect
            and then you can tabulate the number of correct answers:

            Code:
            . tab num_correct
            
            num_correct |      Freq.     Percent        Cum.
            ------------+-----------------------------------
                      1 |          1       16.67       16.67
                      2 |          3       50.00       66.67
                      4 |          1       16.67       83.33
                      5 |          1       16.67      100.00
            ------------+-----------------------------------
                  Total |          6      100.00

            Comment

            Working...
            X