Announcement

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

  • scatterplots for binary variables

    Hi, I am very new to Stata so please forgive me if this is a very basic question.

    I have a binary variable (Pen) that captures whether or not a person receives a pension and an age variable. I want to plot the proportion of pension recipients by age using a scatter plot. I have been struggling with it for a while. Any assistance would be really appreciated.

  • #2
    The mean of a 0/1 indicator is a proportion. A line graph may be a better way to show the trend if this is what you are after.

    Code:
    preserve
    collapse Pen, by(age)
    scatter Pen age, sort
    restore

    Comment


    • #3
      Thank you very much Andrew, this was extremely helpful.
      The x-axis has an interval of 0, 50, 100. How would I change this so that it increases in intervals of 20 instead of 50?

      Comment


      • #4
        Code:
        scatter Pen age, sort xlab(0(20)100)

        Comment


        • #5
          Thank you again

          Comment

          Working...
          X