Menu
Log in


Query: Plotting a model in R

  • 8 Apr 2026 1:23 PM
    Reply # 13618146 on 13612440

    Thanks for all those quality replies! I will at least have an answer in the unlikely event that students ask me about it.

  • 26 Mar 2026 5:38 PM
    Reply # 13613868 on 13612440

    I have just now found this January 2004 exchange of emails 

    Dear Guenther

    Martin Maechler & myself had quite a discussion about this when  we put plot.lm() together. A relevant reference is given on the help page:
    Hinkley, D. V. (1975) On power transformations to symmetry.    _Biometrika_ *62*, 101-111.

    Sandy Weisberg, I think, drew our attention to this.
    The more directly pertinent reference may be:
    Cook & Weisberg (1983). Diagnostics for heteroscedacity in
    regression. Biometrika 70: 1-10.
    There are some further relevant references on p.346 of:
    Cook & Weisberg: Applied Regression Including Computing
    & Graphics.  Wiley 1999.
    Yours sincerely
    John Maindonald.
    On 28 Jan 2004, at 12:46 AM, G. Sawitzki wrote:
    Dear John Maindonald,

    is there a reference for the  "scale location plot" used in plot.lm ? I did not find anything in the references given in the help file. Is it hidden somewhere?

    My usual references are given below.  Cleveland's "s-l"-Plot is not really what is done in R,  but mad versus median.

    Any hints are welcome.

    Yours sincerely,
      gs.

    Cleveland, W.S. (1993), Visualizing Data . Summit, New Jersey: Hobart Press.
    McLeod, A.I. (1999), Improved spread-location visualization.  Journal of Graphical and Computational Statistics 8, 135-141.
    -- 
    ==
    Guenther Sawitzki <gs@statlab.uni-heidelberg.de>  Tel + 62 21 - 54 89 79
    Im Neuenheimer Feld 294, D 69120 Heidelberg       Fax + 62 21 - 54 53 31
                  <http://statlab.uni-heidelberg.de/people/gs/>
  • 24 Mar 2026 2:06 PM
    Reply # 13612889 on 13612440
    Chris Lloyd wrote:

    I have been using the plot(model) option in a new course where the model is generated by lm or nls. My standard call is

    par(mfrow=c(1,2))

    plot(model,which=c(1,3))

    The first plot is residuals versus fitted for detecting problems with the regression function itself. The second one, I think, is to assess constant variance.  But the vertical axis is labelled √|standardised residual|, see attached. 

    Is this a mistake? It seems to me it is wrong. The square root is not necessary. Or you can have the residual squared.

     


    IIRC, there was a discussion about this plot on the Statistical Consulting Network some time ago.  I think somebody even found a reference for why this plot should be used.  Unfortunately, Slack only shows the last 90 days of conversation with a free account, so you have to find somebody on the Statistical Consulting Network who is paying Slack some money for a subscription to get access to this discussion. :-)
  • 24 Mar 2026 7:21 AM
    Reply # 13612702 on 13612440

    Look at ?plot.lm

    "The ‘Scale-Location’ plot (which=3), also called ‘Spread-Location’ or ‘S-L’ plot, takes the square root of the absolute residuals in order to diminish skewness (∣E∣E is much less skewed than ∣E∣E for Gaussian zero-mean E)


  • 23 Mar 2026 6:24 PM
    Reply # 13612449 on 13612440

    This is something not well explained.  If you go back to Statistical Models in S by Chambers and Hastie 1992, the plot appears without the square root (page 104).   While the plot appears there, the purpose is not described, probably because is is "self evident" that is is to gage constancy of variance.

    However, the square root makes the plot work better since it largely avoids the need to guess where the trend is for a skewed distribution - the distribution is closer to normal as can be seen empirically looking at 

    plot(density(sqrt(abs(rnorm(100000)))))

    When the square root was introduced and by whom I have no idea, but it seems a good step.

  • 23 Mar 2026 4:25 PM
    Message # 13612440

    I have been using the plot(model) option in a new course where the model is generated by lm or nls. My standard call is

    par(mfrow=c(1,2))

    plot(model,which=c(1,3))

    The first plot is residuals versus fitted for detecting problems with the regression function itself. The second one, I think, is to assess constant variance.  But the vertical axis is labelled √|standardised residual|, see attached. 

    Is this a mistake? It seems to me it is wrong. The square root is not necessary. Or you can have the residual squared.

     


    1 file
Powered by Wild Apricot Membership Software