Announcement

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

  • Frequency bar graph for values under one variable

    Hi all,

    I am trying to create a bar graph which shows the frequency of conflicts which have no recorded death toll by region, and in this bar graph I want there to be 2 different bar colours, one for developing world and the other for developed world. My objective is to compare whether the recording of deaths in conflict are harder or easier depending on world location.

    In my bar graph because I have found more wars do occur in the developing world I want my bar graph to display proportion/percentage of the conflicts that have no sideadeaths and no sidebdeaths (combined into one value) not just frequency so that I am able to compare the regions.

    Here are the frequencies:

    WhereFought Freq.

    1 81
    2 91
    4 104
    6 72
    7 94

    Total 442 100.00


    The variables are as follows:

    "wherefought" - this variable has been sorted in ascending order from 1-9 using sort 'wherefought, stable'
    1 = W. Hemisphere
    2 = Europe
    4 = Africa
    6 = Middle East
    7 = Asia
    9 = Oceania

    "sideadeaths" -
    -9 represents no data recorded

    "sidebdeaths" -
    -9 represents no data recorded

    For reference this is the data set I am using: www.correlatesofwar.org/data-sets/COW-war

    Any help will be much appreciated!
    Last edited by Finn Sloan; 23 Dec 2017, 03:19.

  • #2
    I'm unsure how to edit the original post, but the situation has changed:

    Essentially what I am trying to compare on my bar graph is the proportion of total conflicts in the data set compared with the proportion of conflicts that have a variable but unknown observations.

    I have worked out the frequency of both using the tabulate function and their percentages.

    The issue is that I had to do this across 2 separate programmes because i was unsure how to include the data before I used the "keep if" function.

    (See the picture of how I want the graph to look).

    Sorry if I've explained what I want poorly but I honestly have no clue how to do it!

    Click image for larger version

Name:	How I want my graph to look.jpg
Views:	1
Size:	284.5 KB
ID:	1423554

    Comment


    • #3
      Unfortunately, you didn't share data to work with, as recommended in the FAQ.

      That said, I hope this toy example fits in your needs:

      Code:
      sysuse auto
      graph bar, over(rep78) over(foreign) asyvars percentages blabel(bar, format(%3.1f)) legend(cols(5)) ytitle(Percentage according to the repair record)
      Click image for larger version

Name:	Graph_bar_percentage.png
Views:	1
Size:	24.3 KB
ID:	1423591
      Best regards,

      Marcos

      Comment

      Working...
      X