Announcement

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

  • Help With Scatter Plot

    I am simply trying to create a scatter plot using an independent variable and a dependent variable, however it is generating the attached photo. Does anyone know why this might be and how to fix it?
    Thank you
    Attached Files

  • #2
    Your two variables are apparently discrete, how much freedom you feel takes on values 1-10 and age takes on values 19-34. Every observation with the same value of the two variables plots on top of each other, so only one shows.

    "Jittering" your plot - which changes the localtion of each point by a small random number - will produce an improved result, perhaps. In the output of help scatter look for the section titled "Jittered Markers" for more details.

    Comment


    • #3
      Observations with the same age and freedom score will plot at the same position. Also, it seems that all possible pairs of scores from 1 to 10 and all ages from 19 to 34 occur. Is this a surprise? To get anything different, you need to jitter the data points or do something quite different. Histograms or bar displays will probably work better. To let people play you would need to contract your data to 160 observations showing age, score and frequency.

      Comment


      • #4
        To show one alternative, I simulated some data. I trust your real pattern is more interesting. Here tabplot is from the Stata Journal. I think of score here as a response to be plotted on the vertical axis.


        Code:
        clear
        set obs 1000
        set seed 2803 
        gen age = runiformint(19, 34)
        gen score = rbinomial(9, 0.5) + 1 
        
        set scheme s1color 
        tabplot score age, yreverse showval(format(%1.0f) mlabsize(vsmall))  percent(age) ysize(7)


        Click image for larger version

Name:	score_age.png
Views:	1
Size:	25.4 KB
ID:	1547876

        Comment

        Working...
        X