dear R community: i have been looking but failed to find the following: is there a function in R that updates a plain OLS lm() model with one additional observation, so that I can write a function that computes recursive residuals *quickly*?


PS: (I looked at package strucchange, but if I am not mistaken, the recresid function there takes longer than iterating over the models fresh from start to end.) I know the two functions do not do the same thing, but the main part (OLS) is the same:
> handrecurse.test <- function( y, x ) { z<- rep(NA, T); for (i in 2:T) { z[i] <- coef(lm(y[1:i] ~ x[1:i]))[2]; }; return(z); }
> system.time(handrecurse.test(y,x))
[1] 0.69 0.00 0.70 0.00 0.00
> system.time(length(recresid( y~x )))
[1] 1.44 0.07 1.59 0.00 0.00


pointers appreciated.  regards, /iaw

---
ivo welch

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to