Announcement

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

  • rvfplot by group?

    I have the following regression model:

    reg mathclass pastmathscores gender race ses

    mathclasss represents the mean of a given math class. I am specifically interested in differences between English Only (EO), RFEP (Reclassified Fluent English Proficient) and English language learners (ELL). These are language classification labels based on student's English proficiency and each student is either an EO, RFEP or ELL. My advisor said "I think that one thing that might be interesting is to run a model that predicts math course peers based on everything but language classification, save the residuals and then plot them by language status. That’ll give you a way to visualize the under- and over- placement of ELLs."

    I did the following:

    reg mathclass pastmathscores gender race ses
    rvfplot, yline(0)

    But I would like to plot the residuals by language status. Can someone explain how I can plot residuals by language classification? I have tried the following but nothing has worked:
    1. by langclass: rvfplot, yline(0)
    2. rvfplot if langclass==1, yline(0)
    3. rvfplot by(langclass), yline(0)



    I am using Stata 13 Windows 7.

    Thanks


  • #2
    As far as I can tell there's no such option, but there is a manual workaround

    Code:
    sysuse auto
    reg price rep78
    predict yhat
    gen resid = price-yhat
    twoway (scatter resid yhat if foreign==0) (scatter resid yhat if foreign==1), yline(0)
    Click image for larger version

Name:	1.png
Views:	1
Size:	4.5 KB
ID:	1340407

    Comment


    • #3
      rvfplot2 from the modeldiag package from the Stata Journal supports the by() option.

      Code:
      search modeldiag
      yields

      SJ-10-1 gr0009_1 . . . . Software update for model diagnostic graph commands
      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
      (help anovaplot, indexplot, modeldiag, ofrtplot, ovfplot,
      qfrplot, racplot, rdplot, regplot, rhetplot, rvfplot2,
      rvlrplot, rvpplot2 if installed)
      Q1/10 SJ 10(1):164
      provides new command rbinplot for plotting means or medians
      of residuals by bins; provides new options for smoothing
      using restricted cubic splines; updates anova examples

      SJ-4-4 gr0009 . . . . . . . . . . Speaking Stata: Graphing model diagnostics
      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox
      (help anovaplot, indexplot, modeldiag, ofrtplot, ovfplot,
      qfrplot, racplot, rdplot, regplot, rhetplot, rvfplot2,
      rvlrplot, rvpplot2 if installed)
      Q4/04 SJ 4(4):449--475
      plotting diagnostic information calculated from residuals
      and fitted values from regression models with continuous
      responses

      See SJ 4-4 at http://www.stata-journal.com/sjpdf.h...iclenum=gr0009 for a write-up and SJ 10-1 files to download.

      A further update of this package is intended in 2016. Among other things, I've renamed rdplot given a later rdplot from others. But that's not yet public, just sitting on my computer.

      Comment

      Working...
      X