[R] R.squared in summary.lm with weights

Murray Efford murray.efford at otago.ac.nz
Sun Apr 10 12:11:33 CEST 2016


Martin -
Thanks, but although hatvalues() is useful for calculating PRESS, I can't find anything directly relevant to my question in the influence help pages. After some burrowing in the literature I'm doubting there is an answer out there (PRESS R^2 is always presented in a fairly ad hoc way).
This is a new topic, as you say, and perhaps better handled on a statistics list.
Murray Efford

[BTW
 stats ::: influence.lm
just gets me
function (model, do.coef = TRUE, ...) 
lm.influence(model, do.coef = do.coef, ...)
<bytecode: 0x00000000081023b8>
<environment: namespace:stats>
which is not very helpful]

________________________________________
From: Martin Maechler <maechler at stat.math.ethz.ch>
Sent: Sunday, 10 April 2016 4:07 a.m.
To: Murray Efford
Cc: peter dalgaard; Duncan Murdoch; r-help at r-project.org
Subject: Re: [R] R.squared in summary.lm with weights

>>>>> Murray Efford <murray.efford at otago.ac.nz>
>>>>>     on Fri, 8 Apr 2016 18:45:33 +0000 writes:

    > Thanks for these perfectly consistent replies - I didn't
    > understand the purpose of m = sum(w * f/sum(w)) and saw it
    > merely as a weighted average of the fitted values.  My
    > ultimate concern is how to compute an appropriate weighted
    > TSS (or equivalently, MSS) for PRESS-R^2 = 1 - PRESS/TSS =
    > 1 - PRESS/ (MSS + PRESS). Do you think it then makes sense
    > to substitute the vector of leave-one-out fitted values
    > for f here?

--> A new topic really.

I think you should find the answer on the help pages (and in the
source) of

     ? influence.measures  (which documents a host of such functions)
    and
     ? influence

Note that influence is S3 generic and

   methods(influence)

indicates that the 'lm' and 'glm' methods are hidden.
Of course I do recommend reading the real R source code (which
   also contains the comments and has some logical order in all the
   function definitions),
but you can use   stats ::: influence.lm
to show a version of the function that looks not too different
from the source.

Martin Maechler, ETH Zurich




More information about the R-help mailing list