Announcement

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

  • Help with the twoway and by command

    Dear all,

    I am trying to do a replication of a study and want to create country scatterplots; my dataset contains members of the European Union of 2008 and has approximately 1500 observations per country per variable.

    I have tried making a graph where trust_EU is y1 and techno_opi is x by country, but I just get this that doesn't show any within-country variation with the following command: twoway dot trust_EU techno_opi, by(country, title("Country scatterplotsā€))
    Failed attempt to create countrygraphs.png

    The following is a sample from the dataset, where 40 = Austria

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int country byte(trust_EU techno_opi)
    40 2 1
    40 3 3
    40 . 4
    40 3 4
    40 3 2
    40 3 .
    40 2 .
    40 3 1
    40 3 1
    40 3 4
    40 3 4
    40 2 4
    40 4 1
    40 4 4
    40 4 2
    40 3 4
    40 3 3
    40 3 4
    40 3 3
    40 3 3
    40 4 2
    40 2 2
    40 2 2
    40 2 4
    40 1 2
    40 4 4
    40 1 4
    40 3 2
    40 3 2
    40 2 2
    40 3 3
    40 4 3
    40 3 2
    40 2 3
    40 3 2
    40 4 1
    40 4 4
    40 4 3
    40 4 2
    40 4 2
    40 3 2
    40 4 3
    40 2 2
    40 3 2
    40 3 .
    40 3 2
    40 2 4
    40 3 3
    40 4 2
    40 4 2
    40 4 1
    40 3 3
    40 3 2
    40 2 4
    40 2 2
    40 3 2
    40 2 2
    40 4 2
    40 . 3
    40 4 1
    40 2 2
    40 2 4
    40 4 2
    40 1 2
    40 . 2
    40 1 4
    40 4 .
    40 3 4
    40 3 4
    40 1 2
    40 3 3
    40 2 2
    40 2 3
    40 4 2
    40 4 .
    40 3 .
    40 4 .
    40 3 2
    40 4 4
    40 3 .
    40 3 .
    40 3 2
    40 4 .
    40 3 .
    40 3 .
    40 3 3
    40 3 2
    40 3 3
    40 3 3
    40 4 3
    40 2 3
    40 3 3
    40 3 3
    40 3 4
    40 3 2
    40 3 2
    40 2 2
    40 . .
    40 3 .
    40 3 .
    end
    label values country COUNTRY
    label def COUNTRY 40 "Austria", modify
    label values trust_EU trust_EU
    label def trust_EU 1 "a great deal", modify
    label def trust_EU 2 "quite a lot", modify
    label def trust_EU 3 "not very much", modify
    label def trust_EU 4 "none at all", modify
    label values techno_opi techno_opi
    label def techno_opi 1 "very good", modify
    label def techno_opi 2 "fairly good", modify
    label def techno_opi 3 "fairly bad", modify
    label def techno_opi 4 "very bad", modify
    I hope you can help.

    Thank you! 😊


  • #2
    In a moderate or large dataset people in every country will collectively show (just about) every possible combination of values of such 4-point scales.

    The presence of a dot could mean anything between one and many instances. Even using twoway scatter will suffer from the same problem. You could try jittering points apart or directly calculate and show frequencies in a bar chart or something similar.

    tabplot from the Stata Journal is one possibility. See e.g. https://www.statalist.org/forums/for...updated-on-ssc

    Comment

    Working...
    X