[R] updating observations in lm

Bert Gunter gunter.berton at gene.com
Mon May 27 18:26:18 CEST 2013


1. You should not be fitting linear models as you describe. For why
not and  how they should be fit, consult a suitable text on numerical
methods (e.g. Givens and Hoeting).

2. In R, I suggest using lm() and ?update, feeding update() data
modified as you like. This is, after all, the reason for update().

-- Bert

On Mon, May 27, 2013 at 8:12 AM, ivo welch <ivo.welch at anderson.ucla.edu> wrote:
> dear R experts---I would like to update OLS regressions with new
> observations on the front of the data, and delete some old
> observations from the rear.  my goal is to have a "flexible"
> moving-window regression, with a minimum number of observations and a
> maximum number of observations.  I can keep (X' X) and (X' y), and add
> or subtract observations from these two quantities myself, and then
> use crossprod.
> strucchange does recursive residuals, which is closely related, but it
> is not designed for such flexible movable windows, nor primarily
> designed to produce standard errors of coefficients.
> before I get started on this, I just wanted to inquire whether someone
> has already written such a function.
> regards,
> /iaw
> ----
> Ivo Welch (ivo.welch at gmail.com)
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374

More information about the R-help mailing list