[Rd] Enhanced version of plot.lm()
John Maindonald
john.maindonald at anu.edu.au
Sun Apr 24 06:37:10 CEST 2005
I'd not like to lose the signs of the residuals. Also, as
plots 1-3 focus on residuals, there is less of a mental
leap in moving to residuals vs leverage; residuals vs
leverage/(1-leverage) would also be in the same spirit.
Maybe, one way or another, both plots (residuals vs
a function of leverage, and the plot from Hinkley et al)
should go in. The easiest way to do this is to add a
further which=6. I will do this if the consensus is that
this is the right way to go. In any case, I'll add the
Hinkley et al reference (author of the contribution that
includes p.74?) to the draft help page.
John Maindonald.
On 24 Apr 2005, at 1:09 AM, David Firth wrote:
> On 23 Apr 2005, at 12:30, John Maindonald wrote:
>
>> I propose the following enhancements and changes to plot.lm(),
>> the most important of which is the addition of a Residuals vs
>> Leverage plot.
>>
>> (1) A residual versus leverage plot has been added, available
>> by specifying which = 5, and not included as one of the default
>> plots. Contours of Cook's distance are included, by default at
>> values of 0.5 and 1.0. The labeled points, if any, are those with
>> the largest Cook's distances. The parameter cook.levels can be
>> changed as required, to control what contours appear.
>>
>> (2) Remove the word "plot" from the captions for which=2, 3, 4.
>> It is redundant.
>>
>> (3) Now that the pos argument to text() is vectorized, use that
>> in preference to an offset.
>>
>> (4) For which!=4 or 5, by default use pos=4 on the left half
>> of the panel, and pos=2 on the right half of the panel.
>> This prevents labels from appearing outside the plot area,
>> where they can overlap other graphical features.
>> The parameter label.pos allows users to change this default.
>>
>> The modified code that I propose is below. This, a modified .Rd
>> file, and files from diff used with the April 20 development version,
>> are in my directory
>>
>> http://wwwmaths.anu.edu.au/~johnm/r/plot-lm/
>>
>> I believe the Residual-Leverage plot is given in Krause & Olsen,
>> whether with Cook's distance contours I do not recall. I do not
>> have access to a copy of this book. Martin Maechler drew my
>> attention to it in 2003, as superior to the Cook's distance plot.
>
> Agreed. Alternatively Cook's distance versus leverage/(1-leverage),
> as on p74 of this book:
> Statistical Theory and Modelling, In honour of Sir David Cox, FRS.
> Eds D V Hinkley, N Reid and E J Snell. Chapman and Hall, 1991.
> In that graph the contours of residual^2 are straight lines through
> the origin. A small disadvantage is that the sign of the residual is
> lost.
>
> David
>
>> I have finally got around to coding it up!
>>
>> John Maindonald.
> ...
>
>
John Maindonald email: john.maindonald at anu.edu.au
phone : +61 2 (6125)3473 fax : +61 2(6125)5549
Centre for Bioinformation Science, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.
More information about the R-devel
mailing list