Announcement

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

  • Scatter Plot

    What command can I use to create a Scatter plot with regression line and line of perfect correlation?

  • #2
    What's the line of perfect correlation? If y = 1 trillion + 1 quadrillion x exactly the correlation would also be 1. There's an infinity of rising straight lines that would yield a correlation of 1 and an infinity of falling straight lines that would yield a correlation of -1.

    Do you mean the line of equality y = x?

    Comment


    • #3
      1:1

      Comment


      • #4
        Yes Nick, y=x

        Comment


        • #5
          OK. I'd call that the line of perfect agreement or the line of equality.

          Here is some technique. The example isn't serious. See also aaplot from SSC.

          Code:
          sysuse citytemp, clear 
          
          set scheme s1color 
          
          scatter tempjul tempjan, ms(Oh) ///
          || lfit tempjul tempjan         ///
          || function Equality=x, ra(tempjan) lp(dash) ///
          legend(order(2 3) col(1) ring(0) pos(5)) ///
          ytitle("`: var label tempjul' ({&degree}F)") /// 
          xtitle("`: var label tempjan' ({&degree}F)") ///
          xsc(titlegap(*5)) aspect(1) yla(, ang(h))
          Click image for larger version

Name:	scatter_equality.png
Views:	1
Size:	54.7 KB
ID:	1487170

          Comment


          • #6
            Thanks very much, Nick
            it has worked perfectly!

            Comment

            Working...
            X