Announcement

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

  • How to design graph for multiple choice question?

    Dear Statalist,

    I hope this finds you well.

    I would like to design a graph (e.g. pie chart or bar graph) for a question that has multiple responses. The table below shows an example of the impact of lack of bank finance on business growth:

    Firm no effect production decrease Sales decrease pressure on cash flow Informal finance
    A 1 . . .
    B . 1 1 . 1
    C . . 1 1 1
    D . 1 1 1 .
    E 1 . . . .
    F . 1 1 . 1
    G . . . 1 1
    H . 1 . 1 1
    I . . 1 . .
    J . . 1 1 1



    Could you please help on how to design a graph for the multiple responses by firms that reflects the effect of lack of bank finance on their growth? I am using Stata MP17

    Greatly appreciate your support

    Best regards,
    Rabab














  • #2
    After 57 posts, we should not be asking you to present data examples using the dataex command. Read FAQ Advice #12 if you have not familiarized yourself with how to use the command. One possibility is to aggregate the responses and graph percentages. You should fix the axis labels, either using variable labels or by relabeling within the command. Below I use myaxis from SSC, by Nick Cox.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str1 firm byte(noeffect productiondecrease salesdecrease pressureoncashflow informalfinance)
    "A" 1 . . . .
    "B" . 1 1 . 1
    "C" . . 1 1 1
    "D" . 1 1 1 .
    "E" 1 . . . .
    "F" . 1 1 . 1
    "G" . . . 1 1
    "H" . 1 . 1 1
    "I" . . 1 . .
    "J" . . 1 1 1
    end
    
    mvencode noeffect -informalfinance, mv(0)
    rename (noeffect -informalfinance) response=
    reshape long response, i(firm) j(which) string
    replace response= response*100
    *ssc install myaxis
    myaxis order=which, sort(sum response) descending
    gr hbar response, over(order) scheme(s1mono) ytitle("Percent")
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	45.0 KB
ID:	1626420

    Comment


    • #3
      Originally posted by Andrew Musau View Post
      After 57 posts, we should not be asking you to present data examples using the dataex command. Read FAQ Advice #12 if you have not familiarized yourself with how to use the command. One possibility is to aggregate the responses and graph percentages. You should fix the axis labels, either using variable labels or by relabeling within the command. Below I use myaxis from SSC, by Nick Cox.

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input str1 firm byte(noeffect productiondecrease salesdecrease pressureoncashflow informalfinance)
      "A" 1 . . . .
      "B" . 1 1 . 1
      "C" . . 1 1 1
      "D" . 1 1 1 .
      "E" 1 . . . .
      "F" . 1 1 . 1
      "G" . . . 1 1
      "H" . 1 . 1 1
      "I" . . 1 . .
      "J" . . 1 1 1
      end
      
      mvencode noeffect -informalfinance, mv(0)
      rename (noeffect -informalfinance) response=
      reshape long response, i(firm) j(which) string
      replace response= response*100
      *ssc install myaxis
      myaxis order=which, sort(sum response) descending
      gr hbar response, over(order) scheme(s1mono) ytitle("Percent")
      [ATTACH=CONFIG]n1626420[/ATTACH]


      Dear Andrew Musau,

      Many thanks for your information.

      I have tried to install the dataex but it did not work with me. Thank you again for your kind efforts to explain to me how to improve designing the requested graph. I will try to apply it.


      Best regards,
      Rabab

      Comment

      Working...
      X