Announcement

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

  • OLS with regression line and scatter plot

    Dear All,
    With two variables, x and y, how do I regress x on y so that I have a graph with the regression line showing scatter plots and the regression equation with estimated parameters?

    Thanks,
    Dapel

  • #2
    I'd say that people customarily talk in terms of regressing y on x. You can regress x on y too, but that's secondary.

    twoway lfit does most but not all of this. Another possibility is aaplot from SSC.

    There are options in aaplot to tune various things, including display formats of coefficients. The default here for RMSE here is pretty silly and the program author really should look at the code for that.

    P-value fetishists will find their question answered in the help.

    If you really want x on y I guess that you may need to program it.

    Somewhere I started writing equivalent programs for logit and Poisson regression plots involving just one predictor, but they are not yet public.

    Code:
    sysuse auto, clear
    gen gp100m = 100/mpg
    aaplot gp100m weight
    Click image for larger version

Name:	aaplot.png
Views:	1
Size:	12.8 KB
ID:	1039295


    Last edited by Nick Cox; 12 Mar 2015, 10:23.

    Comment


    • #3
      I'm there. Thanks a million Dr Cox

      Comment

      Working...
      X