Announcement

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

  • Test Post - re: confidence intervals on bar graph

    Hi

    I am totally new to Stata (using Stata 16.1) and am grateful for any advice you can offer. I am getting more confident in running statistical analysis but still have a lot to learn in terms of presenting data.

    I want to produce a graph that shows the rate of cooperation in an economic game as between two conditions, along with error bars. The rate of cooperation is a percentage amount and, as my data contains binary values (either the participant cooperated with their counterpart, or did not cooperate), I have calculated it using a formula. This is a summary of the relevant results:

    Code:
    clear
    input byte condition float rate int(count n) float error
    0 .5762082 155 269 .030129
    1 .4185185 113 270 .030022
    end
    I have used the following command to give me a quick summary of the data:

    twoway bar rate condition, xlabel(0 1, noticks valuelabel) ylabel(0 "0" .2 "20" .4 "40" .6 "60" .8 "80" 1.0 "100") ytitle(Rate of cooperation (%))

    But I am really struggling to develop out the basic graph. I appreciate that this is a summary data set rather than the full data set and so I am probably doing something wrong just by using this but I am not sure how my main data set will help as it is just binary responses across two conditions. I have looked into cibar, along with posts on Statalist too.

    I also know that people have reservations about using bar plots and I would be happy to take any suggestions about how you might display this data in a more transparent manner.

    Best wishes
    Last edited by Nitish Upadhyaya; 19 Jan 2022, 01:13.

  • #2
    Second test post:

    Hi

    I am trying to move past traditional box and whisker plots given their limitations, and instead want to visualise my data using a stripplot. I am using Stata 16.1 and am very much a novice (although I have tried my best to work through the stripplot guidance).

    Background

    In terms of context, I have asked my participants to play a game. They are split into either condition 0 or condition 1. In each game, they can choose either to cooperate (responsedummy=1) or not to cooperate (responsedummy=0). I have also collected information about various personality traits which are each reported on a scale of 0-5 (extracted below in the dataex as an example are openness and agreeableness, but I have two further traits to analyse). I am trying to understand how specific levels of traits affect cooperation.

    What I have tried so far

    I started with a traditional plot using the following (I appreciate it is messy and has many pitfalls, and I could cut the visualise the data in many ways, hence my desire to investigate stripplots):

    graph box openness agreeableness extraversion honestyhumility, over(condition) over(responsedummy) ylabel(, angle(horizontal))
    Click image for larger version

Name:	Picture1.png
Views:	1
Size:	198.2 KB
ID:	1646341



    But I am now exploring stripplots. I appreciate that the over() command can only be used with a single variable. I am comfortable producing a focused analysis e.g. this for openness:

    stripplot openness, over(responsedummy) box(barw(0.8) blcolor(ltblue)) jitter(3) centre vertical cumul cumpr mc(orange) scheme(s1color) yla(, ang(h))
    Click image for larger version

Name:	Picture2.png
Views:	2
Size:	235.9 KB
ID:	1646342

    What I am hoping for some guidance on

    I am trying to understand how personality traits affect cooperation. I will be running a probit model on the data set so what I am trying to do here is just give the reader as accurate a visual as possible in terms of the descriptive statistics.

    I can't quite seem to get the hang of the by() command mentioned in posts such as this one.

    Ideally I would like to create a stripplot which shows each personality trait side by side (like I have done with the box plot) for one condition, and then broken down by non-cooperation/cooperation. I can then replicate for the other condition.

    I'd like to then be able to have another striplot showing cooperation and personality traits, and then non-cooperation and personality traits.

    Once I get the basics, I'm hoping i'll be able to run with it!

    Dataex

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long id float(openness agreeableness condition responsedummy)
    5460439 2.5 3.3 0 1
    5460448 2.6 2.6 1 1
    5460477 2.6   2 0 1
    5460525 3.5 2.4 0 1
    5460546 3.3 3.2 1 1
    5460586 4.6 4.2 1 1
    5460576 3.5   3 1 1
    5460556 3.9 2.9 0 1
    5460553 2.5 4.1 0 1
    5460558 2.7 2.5 1 1
    5460550 4.3   3 0 0
    5460557 3.5 2.8 1 0
    5460540 3.9 2.8 0 0
    5460521 3.9 2.3 1 0
    5460541 4.4 3.1 0 0
    5460520 3.7 2.4 0 0
    5460522 2.8 3.1 0 1
    5460517 4.6 4.1 1 0
    5460524 2.8 2.5 1 1
    5460518 2.6 3.1 1 0
    5460624 2.5 3.4 1 0
    5460627   4 3.4 0 0
    5460516 3.9 2.3 1 0
    5460505 3.8 3.3 0 0
    5460503 2.9 3.7 1 0
    5460506 4.4 3.4 0 1
    5460502 2.7 2.5 1 1
    5460491 4.2 3.6 1 0
    5460658 2.7   4 1 1
    5460495 4.6 3.9 1 0
    5460484   4 4.2 0 1
    5460482 3.4 2.9 0 0
    5460485 3.1 3.7 1 1
    5460483 3.2 3.3 0 1
    5460471 3.3 2.9 1 1
    5460469 3.3 2.8 0 0
    5460459   3 3.8 0 1
    5460449 3.6 3.5 1 1
    5460442 3.2 2.9 1 1
    5460691 4.4 2.9 0 1
    5460438   3 2.7 1 0
    5460656 4.6 3.9 0 0
    5460435 3.9 3.9 0 1
    5460715 3.5 3.6 1 0
    5460433 3.8 2.6 0 1
    5460709 2.6 4.6 0 1
    5460431 3.5 3.9 1 0
    5460589 3.7 2.8 1 0
    5460569 3.5 3.5 0 1
    5460600 3.8 3.5 1 1
    5460580 4.1 3.2 0 0
    5460590 3.7 2.3 1 1
    5460551 3.1 3.3 1 0
    5460598 4.2 4.5 1 1
    5460593 4.3 3.4 1 0
    5460584 3.3 2.8 0 1
    5460578 4.2 3.3 0 1
    5460564 3.2 1.6 1 0
    5460574 3.9 2.9 0 0
    5460571 3.9 2.6 1 1
    5460555 4.1 3.6 1 0
    5460563 4.5 2.9 0 1
    5460607   4 3.8 0 0
    5460605   3 2.8 0 0
    5460601 2.9 2.4 0 1
    5460616 3.6 3.8 0 1
    5460623 3.4 3.2 0 1
    5460625 3.8 3.3 0 1
    5460615 4.5 3.2 0 1
    5460642 3.5 3.2 1 0
    5460626 4.1 2.5 1 1
    5460695   3 3.5 1 0
    5460721 4.3 4.3 1 1
    5460717 4.2 2.8 1 0
    5460719   3 3.9 0 1
    5460722 3.8 3.8 1 0
    5460735 3.9 3.6 1 0
    5460730 4.1 3.8 0 1
    5460710 3.5   3 0 1
    5460716 2.9 3.3 1 0
    5460737 3.7   3 1 1
    5460734 3.9 3.4 0 0
    5460741 4.3 3.8 1 0
    5460753 4.8 3.4 0 1
    5460789 3.3 2.7 0 1
    5460635 4.1 3.6 1 1
    5460638 3.8 2.9 1 1
    5460640 3.2 1.3 0 1
    5460746 3.9   3 1 1
    5460777 3.6 3.3 0 0
    5460778 3.5 2.7 1 0
    5460650 2.6 3.5 0 0
    5460644 2.8 3.1 1 1
    5460651 2.7 3.1 1 0
    5460649 2.1 3.9 0 0
    5460661 4.4 2.6 1 0
    5460660   3 4.4 1 0
    5460647 3.2 3.5 1 1
    5460671   4 4.3 0 1
    5460652   4 2.2 0 1
    end
    Last edited by Nitish Upadhyaya; 23 Jan 2022, 05:16.

    Comment

    Working...
    X