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

Martin Maechler maechler at stat.math.ethz.ch
Sat Apr 9 18:07:18 CEST 2016


>>>>> 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